Change in openvpn[master]: Remove instances of constParameterPointer cppcheck warnings
A message that is not in the archive (sent off-list or not yet received): gerrit.1778068501000.I56248cf6d199c2da770774b8fd1e5daf2b116f58@...2715...
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1663?usp=email
to review the following change.
Change subject: Remove instances of constParameterPointer cppcheck warnings
......................................................................
Remove instances of constParameterPointer cppcheck warnings
This requires a few suppressions since cppcheck
doesn't quite understand the different code-paths
implemented by preprocessor defines.
---
M dev-tools/cppcheck-suppression
M dev-tools/run-cppcheck.sh
M sample/sample-plugins/client-connect/sample-client-connect.c
M sample/sample-plugins/defer/multi-auth.c
M sample/sample-plugins/keying-material-exporter-demo/keyingmaterialexporter.c M src/openvpn/buffer.c
M src/openvpn/buffer.h
M src/openvpn/clinat.c
M src/openvpn/clinat.h
M src/openvpn/comp.c
M src/openvpn/comp.h
M src/openvpn/crypto.c
M src/openvpn/crypto.h
M src/openvpn/dco.c
M src/openvpn/dco.h
M src/openvpn/dco_freebsd.c
M src/openvpn/dco_internal.h
M src/openvpn/dco_linux.c
M src/openvpn/dco_win.c
M src/openvpn/dhcp.c
M src/openvpn/dhcp.h
M src/openvpn/event.h
M src/openvpn/forward.c
M src/openvpn/forward.h
M src/openvpn/init.c
M src/openvpn/init.h
M src/openvpn/interval.h
M src/openvpn/list.c
M src/openvpn/list.h
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/mbuf.c
M src/openvpn/mbuf.h
M src/openvpn/mss.c
M src/openvpn/mss.h
M src/openvpn/mtcp.c
M src/openvpn/mtcp.h
M src/openvpn/mudp.c
M src/openvpn/multi.c
M src/openvpn/multi.h
M src/openvpn/networking.h
M src/openvpn/networking_iproute2.c
M src/openvpn/networking_sitnl.c
M src/openvpn/occ.h
M src/openvpn/openssl_compat.h
M src/openvpn/options.c
M src/openvpn/options_parse.c
M src/openvpn/otime.c
M src/openvpn/otime.h
M src/openvpn/proto.h
M src/openvpn/proxy.c
M src/openvpn/proxy.h
M src/openvpn/push.c
M src/openvpn/push.h
M src/openvpn/push_util.c
M src/openvpn/reliable.c
M src/openvpn/reliable.h
M src/openvpn/route.c
M src/openvpn/socket.c
M src/openvpn/socket.h
M src/openvpn/socket_util.h
M src/openvpn/socks.c
M src/openvpn/socks.h
M src/openvpn/ssl.c
M src/openvpn/ssl.h
M src/openvpn/ssl_backend.h
M src/openvpn/ssl_mbedtls.c
M src/openvpn/ssl_openssl.c
M src/openvpn/ssl_pkt.c
M src/openvpn/ssl_pkt.h
M src/openvpn/ssl_verify.c
M src/openvpn/ssl_verify.h
M src/openvpn/tun.c
M src/openvpn/tun.h
M src/openvpn/tun_afunix.c
M src/openvpn/tun_afunix.h
M src/openvpn/vlan.c
M src/openvpn/vlan.h
M src/openvpnmsica/openvpnmsica.c
M src/openvpnserv/interactive.c
M tests/t_client.sh.in
M tests/unit_tests/openvpn/mock_management.c
M tests/unit_tests/openvpn/test_misc.c
M tests/unit_tests/openvpn/test_user_pass.c
84 files changed, 248 insertions(+), 226 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/63/1663/1
dev-tools/cppcheck-suppression +21 -1
@@ -2,7 +2,6 @@ # occurences right now. They still should be fixed at some point constParameter constParameterCallback -constParameterPointer variableScope # We have a lot of library includes, not all of them are really required, # so ignore them
@@ -20,6 +19,27 @@ # IGN: the code header = 0 | (OPCODE << P_OPCODE_SHIFT) is used intentionally badBitmaskCheck:src/openvpn/mudp.c badBitmaskCheck:tests/unit_tests/openvpn/test_pkt.c +constParameterPointer:/usr/include/* +# IGN: test files provide mocks/stubs that match prototypes from headers exactly +constParameterPointer:tests/unit_tests/openvpn/mock_* +constParameterPointer:tests/unit_tests/openvpn/test_* +constParameterPointer:tests/unit_tests/openvpnserv/test_* +# FP: the restriction to OpenSSL >= 3 seems to confuse cppcheck +constParameterPointer:src/openvpn/crypto_openssl.c:172 +# FP: parameters are modified on Windows (or non-Linux) only +constParameterPointer:src/openvpn/error.c:223 +constParameterPointer:src/openvpn/manage.c:3332 +constParameterPointer:src/openvpn/misc.c:792 +constParameterPointer:src/openvpn/misc.c:812 +constParameterPointer:src/openvpn/options.c:3205 +constParameterPointer:src/openvpn/route.c:3945 +constParameterPointer:src/openvpn/socket.c:2246 +constParameterPointer:src/openvpn/socket.h:726 +constParameterPointer:src/openvpn/socket.h:825 +constParameterPointer:src/openvpn/ssl_openssl.c:540 +constParameterPointer:src/openvpn/tun.c:560 +# FP: local is modified via cast inside function +constParameterPointer:src/openvpn/dco.c:560 # IGN: event code uses a pointer to store integers intToPointerCast:src/openvpn/multi_io.c intToPointerCast:src/openvpn/forward.c
dev-tools/run-cppcheck.sh +1 -1
@@ -13,7 +13,7 @@ mkdir -p "$CPPCHECK_DIR" cd "${SOURCE_DIR}" cppcheck -j$(nproc) \ - -DHAVE_CONFIG_H -U_WIN32 \ + -DHAVE_CONFIG_H \ -DMBEDTLS_SSL_PROTO_TLS1_3 -DMBEDTLS_SSL_KEYING_MATERIAL_EXPORT \ -I./include/ -I./tests/unit_tests/openvpn/ \ -I./src/compat/ -I./src/openvpn/ -I./src/openvpnserv/ -I./src/plugins/auth-pam/ \
sample/sample-plugins/client-connect/sample-client-connect.c +2 -2
@@ -344,7 +344,7 @@ }int -openvpn_plugin_client_connect (struct plugin_context *context,const char **argv,const char **envp) +openvpn_plugin_client_connect (const struct plugin_context *context,const char **argv,const char **envp) {/* log environment variables handed to us by OpenVPN, but * only if "setenv verb" is 3 or higher (arbitrary number)
@@ -465,7 +465,7 @@int openvpn_plugin_client_connect_defer_v2 (struct plugin_context *context, -struct plugin_per_client_context *pcc, +const struct plugin_per_client_context *pcc,struct openvpn_plugin_string_list **return_list) {time_t time_left = pcc->sleep_until -time (NULL );
sample/sample-plugins/defer/multi-auth.c +1 -1
@@ -255,7 +255,7 @@ }static bool -do_auth_user_pass (struct plugin_context *context,const char *username,const char *password) +do_auth_user_pass (const struct plugin_context *context,const char *username,const char *password) {plog (context,PLOG_NOTE ,"expect_user=%s, received_user=%s, expect_passw=%s, received_passw=%s" ,np (context->test_valid_user),np (username),np (context->test_valid_pass),np (password));
sample/sample-plugins/keying-material-exporter-demo/keyingmaterialexporter.c +3 -3
@@ -186,7 +186,7 @@ }static void -file_store (char *file,char *content) +file_store (const char *file,const char *content) {FILE *f;if (!(f =fopen (file,"w+" )))
@@ -202,7 +202,7 @@ server_store(struct openvpn_plugin_args_func_in const *args) {struct plugin *plugin = (struct plugin *)args->handle; -struct session *sess = (struct session *)args->per_client_context; +const struct session *sess = (struct session *)args->per_client_context;char file[MAXPATH ];snprintf (file,sizeof (file) -1 ,"/tmp/openvpn_sso_%s" , sess->key);
@@ -214,7 +214,7 @@ client_store(struct openvpn_plugin_args_func_in const *args) {struct plugin *plugin = (struct plugin *)args->handle; -struct session *sess = (struct session *)args->per_client_context; +const struct session *sess = (struct session *)args->per_client_context;char *file ="/tmp/openvpn_sso_user" ;ovpn_note ("app session file: %s" , file);
src/openvpn/buffer.c +2 -2
@@ -285,7 +285,7 @@* truncated by buf_printf */ void -buf_catrunc (struct buffer *buf,const char *str) +buf_catrunc (const struct buffer *buf,const char *str) {if (buf_forward_capacity (buf) <=1 ) {
@@ -1086,7 +1086,7 @@ }bool -string_check_buf (struct buffer *buf,const unsigned int inclusive,const unsigned int exclusive) +string_check_buf (const struct buffer *buf,const unsigned int inclusive,const unsigned int exclusive) {ASSERT (buf);
src/openvpn/buffer.h +4 -4
@@ -487,7 +487,7 @@* write a string to the end of a buffer that was * truncated by buf_printf */ -void buf_catrunc (struct buffer *buf,const char *str); +void buf_catrunc (const struct buffer *buf,const char *str);/* * Parse a string based on a given delimiter char
@@ -774,7 +774,7 @@ }static inline int -buf_peek_u8 (struct buffer *buf) +buf_peek_u8 (const struct buffer *buf) {int ret;if (BLEN (buf) <1 )
@@ -923,7 +923,7 @@* @param exclusive Character classes that are not allowed even if they are also in inclusive. * @return True if the string consists only of allowed characters, false otherwise. */ -bool string_check_buf (struct buffer *buf,const unsigned int inclusive, +bool string_check_buf (const struct buffer *buf,const unsigned int inclusive,const unsigned int exclusive);/**
@@ -1102,7 +1102,7 @@ }static inline void -check_malloc_return (void *p) +check_malloc_return (const void *p) {if (!p) {
src/openvpn/clinat.c +1 -1
@@ -181,7 +181,7 @@ }void -client_nat_transform (const struct client_nat_option_list *list,struct buffer *ipbuf, +client_nat_transform (const struct client_nat_option_list *list,const struct buffer *ipbuf,const int direction) {struct ip_tcp_udp_hdr *h = (struct ip_tcp_udp_hdr *)BPTR (ipbuf);
src/openvpn/clinat.h +1 -1
@@ -60,7 +60,7 @@ const char *network, const char *netmask, const char *foreign_network, msglvl_t msglevel); -void client_nat_transform (const struct client_nat_option_list *list,struct buffer *ipbuf, +void client_nat_transform (const struct client_nat_option_list *list,const struct buffer *ipbuf,const int direction);#endif /* if !defined(CLINAT_H) */
src/openvpn/comp.c +1 -1
@@ -159,7 +159,7 @@#endif /* USE_COMP */ bool -check_compression_settings_valid (struct compress_options *info,msglvl_t msglevel) +check_compression_settings_valid (const struct compress_options *info,msglvl_t msglevel) {/* * We also allow comp-stub-v2 here as it technically allows escaping of
src/openvpn/comp.h +1 -1
@@ -91,7 +91,7 @@* flags of allow-compression and also the whether algorithms are compiled * in */ -bool check_compression_settings_valid (struct compress_options *info,msglvl_t msglevel); +bool check_compression_settings_valid (const struct compress_options *info,msglvl_t msglevel);#ifdef USE_COMP #include "buffer.h"
src/openvpn/crypto.c +3 -3
@@ -1105,7 +1105,7 @@ }static bool -key_is_zero (struct key *key,const struct key_type *kt) +key_is_zero (const struct key *key,const struct key_type *kt) {size_t cipher_length =cipher_kt_key_size (kt->cipher);for (size_t i =0 ; i < cipher_length; ++i)
@@ -1123,7 +1123,7 @@* Make sure that cipher key is a valid key for current key_type. */ bool -check_key (struct key *key,const struct key_type *kt) +check_key (const struct key *key,const struct key_type *kt) {if (cipher_defined (kt->cipher)) {
@@ -1196,7 +1196,7 @@ }void -test_crypto (struct crypto_options *co,struct frame *frame) +test_crypto (struct crypto_options *co,const struct frame *frame) {int i, j;struct gc_arena gc =gc_new ();
src/openvpn/crypto.h +2 -2
@@ -414,7 +414,7 @@*/ int write_key_file (const int nkeys,const char *filename); -bool check_key (struct key *key,const struct key_type *kt); +bool check_key (const struct key *key,const struct key_type *kt);/** * Initialize a key_type structure with.
@@ -609,7 +609,7 @@/** Print a cipher list entry */ void print_cipher (const char *cipher); -void test_crypto (struct crypto_options *co,struct frame *f); +void test_crypto (struct crypto_options *co,const struct frame *f);/* key direction functions */
src/openvpn/dco.c +4 -4
@@ -556,7 +556,7 @@ }static bool -dco_multi_get_localaddr (struct multi_context *m,struct multi_instance *mi, +dco_multi_get_localaddr (const struct multi_context *m,const struct multi_instance *mi,struct sockaddr_storage *local) {#if ENABLE_IP_PKTINFO
@@ -568,7 +568,7 @@return false; } -struct link_socket_actual *actual = &c->c2.link_socket_infos[0 ]->lsa->actual; +const struct link_socket_actual *actual = &c->c2.link_socket_infos[0 ]->lsa->actual;switch (actual->dest.addr.sa.sa_family) {
@@ -606,7 +606,7 @@ }int -dco_multi_add_new_peer (struct multi_context *m,struct multi_instance *mi) +dco_multi_add_new_peer (const struct multi_context *m,struct multi_instance *mi) {const struct context *c = &mi->context;
@@ -779,7 +779,7 @@/* Checked if we added a host route as the assigned client IP address was * outside the --ifconfig-ipv6 tun interface config */ #if !defined(_WIN32) -struct in6_addr *dest = &mi->context.c2.push_ifconfig_ipv6_local; +const struct in6_addr *dest = &mi->context.c2.push_ifconfig_ipv6_local;if (multi_check_push_ifconfig_ipv6_extra_route (mi, dest)) {/* On windows we do not install these routes, so we also do not need to delete them */
src/openvpn/dco.h +6 -6
@@ -138,7 +138,7 @@/** * Install a DCO in the main event loop */ -void dco_event_set (dco_context_t *dco,struct event_set *es,void *arg); +void dco_event_set (const dco_context_t *dco,struct event_set *es,void *arg);/** * Install the key material in DCO for the specified peer.
@@ -204,7 +204,7 @@* @param mi the client instance * @return 0 on success or a negative error code otherwise */ -int dco_multi_add_new_peer (struct multi_context *m,struct multi_instance *mi); +int dco_multi_add_new_peer (const struct multi_context *m,struct multi_instance *mi);/** * Install an iroute in DCO, which means adding a route to the system routing
@@ -253,7 +253,7 @@* a 64 bit packet counter and AEAD tag at the end. */ bool -dco_supports_epoch_data (struct context *c); +dco_supports_epoch_data (const struct context *c);#else /* if defined(ENABLE_DCO) */ typedef void *dco_context_t ;
@@ -313,7 +313,7 @@ }static inline void -dco_event_set (dco_context_t *dco,struct event_set *es,void *arg) +dco_event_set (const dco_context_t *dco,struct event_set *es,void *arg) { }
@@ -350,7 +350,7 @@ }static inline int -dco_multi_add_new_peer (struct multi_context *m,struct multi_instance *mi) +dco_multi_add_new_peer (const struct multi_context *m,struct multi_instance *mi) {return 0 ; }
@@ -384,7 +384,7 @@ }static inline bool -dco_supports_epoch_data (struct context *c) +dco_supports_epoch_data (const struct context *c) {return false; }
src/openvpn/dco_freebsd.c +2 -2
@@ -778,7 +778,7 @@ }void -dco_event_set (dco_context_t *dco,struct event_set *es,void *arg) +dco_event_set (const dco_context_t *dco,struct event_set *es,void *arg) {struct ifdrv drv;nvlist_t *nvl;
@@ -929,7 +929,7 @@ }bool -dco_supports_epoch_data (struct context *c) +dco_supports_epoch_data (const struct context *c) {return false; }
src/openvpn/dco_internal.h +3 -2
@@ -59,8 +59,9 @@* They are implemented by dco_linux.c */ -int dco_new_peer (dco_context_t *dco,unsigned int peerid,socket_descriptor_t sd,struct sockaddr *localaddr, -struct sockaddr *remoteaddr,const struct in_addr *vpn_ipv4,const struct in6_addr *vpn_ipv6); +int dco_new_peer (dco_context_t *dco,unsigned int peerid,socket_descriptor_t sd, +struct sockaddr *localaddr,struct sockaddr *remoteaddr, +const struct in_addr *vpn_ipv4,const struct in6_addr *vpn_ipv6);int dco_del_peer (dco_context_t *dco,unsigned int peerid);
src/openvpn/dco_linux.c +5 -5
@@ -114,7 +114,7 @@ }static struct nl_msg * -ovpn_dco_nlmsg_create (dco_context_t *dco,uint8_t cmd) +ovpn_dco_nlmsg_create (const dco_context_t *dco,uint8_t cmd) {struct nl_msg *nl_msg =nlmsg_alloc ();if (!nl_msg)
@@ -804,7 +804,7 @@/* libnl < 3.11.0 does not implement nla_get_uint() */ static uint64_t -ovpn_nla_get_uint (struct nlattr *attr) +ovpn_nla_get_uint (const struct nlattr *attr) {if (nla_len (attr) ==sizeof (uint32_t )) {
@@ -916,7 +916,7 @@ }static bool -ovpn_iface_check (dco_context_t *dco,struct nlattr *attrs[]) +ovpn_iface_check (const dco_context_t *dco,struct nlattr *attrs[]) {/* we must know which interface this message is referring to in order to * avoid mixing messages for other instances
@@ -1325,7 +1325,7 @@ }void -dco_event_set (dco_context_t *dco,struct event_set *es,void *arg) +dco_event_set (const dco_context_t *dco,struct event_set *es,void *arg) {if (dco && dco->nl_sock) {
@@ -1340,7 +1340,7 @@ }bool -dco_supports_epoch_data (struct context *c) +dco_supports_epoch_data (const struct context *c) {return false; }
src/openvpn/dco_win.c +2 -2
@@ -939,7 +939,7 @@ }void -dco_event_set (dco_context_t *dco,struct event_set *es,void *arg) +dco_event_set (const dco_context_t *dco,struct event_set *es,void *arg) {if (dco->ifmode !=DCO_MODE_MP ) {
@@ -1100,7 +1100,7 @@ }bool -dco_supports_epoch_data (struct context *c) +dco_supports_epoch_data (const struct context *c) {OVPN_VERSION ver = {0 };return dco_get_version (&ver) && ((ver.Major ==2 && ver.Minor >=8 ) || (ver.Major >2 ));
src/openvpn/dhcp.c +1 -1
@@ -145,7 +145,7 @@ }in_addr_t -dhcp_extract_router_msg (struct buffer *ipbuf) +dhcp_extract_router_msg (const struct buffer *ipbuf) {struct dhcp_full *df = (struct dhcp_full *)BPTR (ipbuf); const int optlen =
src/openvpn/dhcp.h +1 -1
@@ -91,7 +91,7 @@#pragma pack() -in_addr_t dhcp_extract_router_msg (struct buffer *ipbuf); +in_addr_t dhcp_extract_router_msg (const struct buffer *ipbuf);#if defined(_WIN32) || defined(DHCP_UNIT_TEST )#include "tun.h"
src/openvpn/event.h +1 -1
@@ -204,7 +204,7 @@#else /* ifdef _WIN32 */ static inline void -wait_signal (struct event_set *es,void *arg) +wait_signal (const struct event_set *es,const void *arg) { }
src/openvpn/forward.c +6 -6
@@ -231,7 +231,7 @@ }static void -parse_incoming_control_channel_command (struct context *c,struct buffer *buf) +parse_incoming_control_channel_command (struct context *c,const struct buffer *buf) {if (buf_string_match_head_str (buf,"AUTH_FAILED" )) {
@@ -501,7 +501,7 @@ }int -get_server_poll_remaining_time (struct event_timeout *server_poll_timeout) +get_server_poll_remaining_time (const struct event_timeout *server_poll_timeout) {update_time ();int remaining =event_timeout_remaining (server_poll_timeout);
@@ -598,7 +598,7 @@* Buffer reallocation, for use with null encryption. */ static inline void -buffer_turnover (const uint8_t *orig_buf,struct buffer *dest_stub,struct buffer *src_stub, +buffer_turnover (const uint8_t *orig_buf,struct buffer *dest_stub,const struct buffer *src_stub,struct buffer *storage) {if (orig_buf == src_stub->data && src_stub->data != storage->data)
@@ -885,7 +885,7 @@*/ static inline void -socks_postprocess_incoming_link (struct context *c,struct link_socket *sock) +socks_postprocess_incoming_link (struct context *c,const struct link_socket *sock) {if (sock->socks_proxy && sock->info.proto ==PROTO_UDP ) {
@@ -984,7 +984,7 @@ }bool -process_incoming_link_part1 (struct context *c,struct link_socket_info *lsi,bool floated) +process_incoming_link_part1 (struct context *c,const struct link_socket_info *lsi,bool floated) {struct gc_arena gc =gc_new ();bool decrypt_status = false;
@@ -1534,7 +1534,7 @@* @param client Determines whether to the send packet back via tun or link */ void -ipv6_send_icmp_unreachable (struct context *c,struct buffer *buf,bool client) +ipv6_send_icmp_unreachable (struct context *c,const struct buffer *buf,bool client) {#define MAX_ICMPV6LEN 1280struct openvpn_icmp6hdr icmp6out;
src/openvpn/forward.h +2 -2
@@ -112,7 +112,7 @@*/ void encrypt_sign (struct context *c,bool comp_frag); -int get_server_poll_remaining_time (struct event_timeout *server_poll_timeout); +int get_server_poll_remaining_time (const struct event_timeout *server_poll_timeout);/**********************************************************************/ /**
@@ -163,7 +163,7 @@* * @return true if packet is authenticated, false otherwise. */ -bool process_incoming_link_part1 (struct context *c,struct link_socket_info *lsi,bool floated); +bool process_incoming_link_part1 (struct context *c,const struct link_socket_info *lsi,bool floated);/** * Continues processing a packet read from the external network interface.
src/openvpn/init.c +4 -4
@@ -1269,7 +1269,7 @@* prepending to msg() output. */ const char * -format_common_name (struct context *c,struct gc_arena *gc) +format_common_name (const struct context *c,struct gc_arena *gc) {struct buffer out =alloc_buf_gc (256 , gc);if (c->c2.tls_multi)
@@ -1755,7 +1755,7 @@static bool -can_preserve_tun (struct tuntap *tt) +can_preserve_tun (const struct tuntap *tt) {if (tt && tt->backend_driver ==DRIVER_AFUNIX ) {
@@ -1777,7 +1777,7 @@* @param c pointer to the connection context */ static void -add_wfp_block (struct context *c) +add_wfp_block (const struct context *c) {#if defined(_WIN32)/* Fortify 'redirect-gateway block-local' with firewall rules? */
@@ -1803,7 +1803,7 @@* @param adapter_index the VPN adapter index */ static void -del_wfp_block (struct context *c,unsigned long adapter_index) +del_wfp_block (const struct context *c,unsigned long adapter_index) {#if defined(_WIN32)if (c->options.block_outside_dns ||block_local_needed (c->c1.route_list))
src/openvpn/init.h +1 -1
@@ -91,7 +91,7 @@unsigned int pull_permission_mask (const struct context *c); -const char *format_common_name (struct context *c,struct gc_arena *gc); +const char *format_common_name (const struct context *c,struct gc_arena *gc);void reset_coarse_timers (struct context *c);
src/openvpn/interval.h +2 -2
@@ -89,7 +89,7 @@ }static inline void -interval_schedule_wakeup (struct interval *top,interval_t *wakeup) +interval_schedule_wakeup (const struct interval *top,interval_t *wakeup) {const time_t local_now = now;interval_earliest_wakeup (wakeup, top->last_test_true + top->refresh, local_now);
@@ -214,7 +214,7 @@* This function does not check if the timeout is actually valid. */ static inline interval_t -event_timeout_remaining (struct event_timeout *et) +event_timeout_remaining (const struct event_timeout *et) {return (interval_t)((et->last + et->n) - now); }
src/openvpn/list.c +1 -1
@@ -162,7 +162,7 @@ }void -hash_remove_by_value (struct hash *hash,void *value) +hash_remove_by_value (struct hash *hash,const void *value) {struct hash_iterator hi;const struct hash_element *he;
src/openvpn/list.h +1 -1
@@ -73,7 +73,7 @@bool hash_remove_fast (struct hash *hash,struct hash_bucket *bucket,const void *key,uint32_t hv); -void hash_remove_by_value (struct hash *hash,void *value); +void hash_remove_by_value (struct hash *hash,const void *value);struct hash_iterator {
src/openvpn/manage.c +13 -12
@@ -330,7 +330,7 @@ }static void -man_delete_unix_socket (struct management *man) +man_delete_unix_socket (const struct management *man) {#if UNIX_SOCK_SUPPORT if ((man->settings.flags & (MF_UNIX_SOCK |MF_CONNECT_AS_CLIENT )) ==MF_UNIX_SOCK )
@@ -675,7 +675,7 @@* for the log and echo commands. */ static void -man_history (struct management *man,const char *parm,const char *type,struct log_history *log, +man_history (struct management *man,const char *parm,const char *type,const struct log_history *log,bool *realtime,const unsigned int lep_flags) {struct gc_arena gc =gc_new ();
@@ -843,7 +843,7 @@ }static void -man_forget_passwords (struct management *man) +man_forget_passwords (const struct management *man) {ssl_purge_auth (false); (void )ssl_clean_auth_token ();
@@ -851,7 +851,7 @@ }static void -man_net (struct management *man) +man_net (const struct management *man) {if (man->persist.callback.show_net) {
@@ -887,7 +887,7 @@#ifdef ENABLE_PKCS11 static void -man_pkcs11_id_count (struct management *man) +man_pkcs11_id_count (const struct management *man) {msg (M_CLIENT ,">PKCS11ID-COUNT:%d" ,pkcs11_management_id_count ()); }
@@ -1350,7 +1350,7 @@* @return Return whether p has n (or at least n) parameters */ static bool -man_need (struct management *man,const char **p,const int n,unsigned int flags) +man_need (const struct management *man,const char **p,const int n,unsigned int flags) {int i;ASSERT (p[0 ]);
@@ -3013,7 +3013,7 @@ }void -management_up_down (struct management *man,const char *updown,const struct env_set *es) +management_up_down (const struct management *man,const char *updown,const struct env_set *es) {if (man->settings.flags &MF_UP_DOWN ) {
@@ -3023,13 +3023,13 @@ }void -management_notify (struct management *man,const char *severity,const char *type,const char *text) +management_notify (const struct management *man,const char *severity,const char *type,const char *text) {msg (M_CLIENT ,">NOTIFY:%s,%s,%s" , severity, type, text); }void -management_notify_generic (struct management *man,const char *str) +management_notify_generic (const struct management *man,const char *str) {msg (M_CLIENT ,"%s" , str); }
@@ -3115,7 +3115,8 @@ }void -management_notify_client_close (struct management *management,struct man_def_auth_context *mdac, +management_notify_client_close (const struct management *management, +struct man_def_auth_context *mdac,const struct env_set *es) {if ((mdac->flags &DAF_INITIAL_AUTH ) && !(mdac->flags &DAF_CONNECTION_CLOSED ))
@@ -3206,7 +3207,7 @@ }void -management_auth_failure (struct management *man,const char *type,const char *reason) +management_auth_failure (const struct management *man,const char *type,const char *reason) {if (reason) {
@@ -3219,7 +3220,7 @@ }void -management_auth_token (struct management *man,const char *token) +management_auth_token (const struct management *man,const char *token) {msg (M_CLIENT ,">PASSWORD:Auth-Token:%s" , token); }
src/openvpn/manage.h +6 -6
@@ -376,12 +376,12 @@void management_event_loop_n_seconds (struct management *man,int sec); -void management_up_down (struct management *man,const char *updown,const struct env_set *es); +void management_up_down (const struct management *man,const char *updown,const struct env_set *es); -void management_notify (struct management *man,const char *severity,const char *type, +void management_notify (const struct management *man,const char *severity,const char *type,const char *text); -void management_notify_generic (struct management *man,const char *str); +void management_notify_generic (const struct management *man,const char *str); void management_notify_client_needing_auth(struct management *management, const unsigned int auth_id,
@@ -391,7 +391,7 @@void management_connection_established (struct management *management,struct man_def_auth_context *mdac,const struct env_set *es); -void management_notify_client_close (struct management *management, +void management_notify_client_close (const struct management *management,struct man_def_auth_context *mdac,const struct env_set *es); void management_learn_addr(struct management *management, struct man_def_auth_context *mdac,
@@ -476,12 +476,12 @@* OpenVPN calls here to indicate a password failure */ -void management_auth_failure (struct management *man,const char *type,const char *reason); +void management_auth_failure (const struct management *man,const char *type,const char *reason);/* * Echo an authentication token to management interface */ -void management_auth_token (struct management *man,const char *token); +void management_auth_token (const struct management *man,const char *token);/* * These functions drive the bytecount in/out counters.
src/openvpn/mbuf.c +1 -1
@@ -160,7 +160,7 @@ }void -mbuf_dereference_instance (struct mbuf_set *ms,struct multi_instance *mi) +mbuf_dereference_instance (struct mbuf_set *ms,const struct multi_instance *mi) {if (ms) {
src/openvpn/mbuf.h +1 -1
@@ -75,7 +75,7 @@bool mbuf_extract_item (struct mbuf_set *ms,struct mbuf_item *item); -void mbuf_dereference_instance (struct mbuf_set *ms,struct multi_instance *mi); +void mbuf_dereference_instance (struct mbuf_set *ms,const struct multi_instance *mi);static inline bool mbuf_defined (const struct mbuf_set *ms)
src/openvpn/mss.c +9 -9
@@ -43,7 +43,7 @@* if yes, hand to mss_fixup_dowork() */ void -mss_fixup_ipv4 (struct buffer *buf,uint16_t maxmss) +mss_fixup_ipv4 (const struct buffer *buf,uint16_t maxmss) {const struct openvpn_iphdr *pip;int hlen;
@@ -80,7 +80,7 @@* (IPv6 header structure is sufficiently different from IPv4...) */ void -mss_fixup_ipv6 (struct buffer *buf,uint16_t maxmss) +mss_fixup_ipv6 (const struct buffer *buf,uint16_t maxmss) {const struct openvpn_ipv6hdr *pip6;struct buffer newbuf;
@@ -136,7 +136,7 @@*/ void -mss_fixup_dowork (struct buffer *buf,uint16_t maxmss) +mss_fixup_dowork (const struct buffer *buf,uint16_t maxmss) {int olen, optlen;uint8_t *opt;
@@ -239,8 +239,8 @@ }static void -frame_calculate_fragment (struct frame *frame,struct key_type *kt,const struct options *options, -struct link_socket_info *lsi) +frame_calculate_fragment (struct frame *frame,const struct key_type *kt,const struct options *options, +const struct link_socket_info *lsi) {#if defined(ENABLE_FRAGMENT )size_t overhead;
@@ -269,8 +269,8 @@ }static void -frame_calculate_mssfix (struct frame *frame,struct key_type *kt,const struct options *options, -struct link_socket_info *lsi) +frame_calculate_mssfix (struct frame *frame,const struct key_type *kt,const struct options *options, +const struct link_socket_info *lsi) {if (options->ce.mssfix_fixed) {
@@ -314,8 +314,8 @@ }void -frame_calculate_dynamic (struct frame *frame,struct key_type *kt,const struct options *options, -struct link_socket_info *lsi) +frame_calculate_dynamic (struct frame *frame,const struct key_type *kt,const struct options *options, +const struct link_socket_info *lsi) {if (options->ce.fragment >0 ) {
src/openvpn/mss.h +5 -5
@@ -29,15 +29,15 @@#include "socket.h" #include "ssl_common.h" -void mss_fixup_ipv4 (struct buffer *buf,uint16_t maxmss); +void mss_fixup_ipv4 (const struct buffer *buf,uint16_t maxmss); -void mss_fixup_ipv6 (struct buffer *buf,uint16_t maxmss); +void mss_fixup_ipv6 (const struct buffer *buf,uint16_t maxmss); -void mss_fixup_dowork (struct buffer *buf,uint16_t maxmss); +void mss_fixup_dowork (const struct buffer *buf,uint16_t maxmss);/** Set the --mssfix option. */ -void frame_calculate_dynamic (struct frame *frame,struct key_type *kt, -const struct options *options,struct link_socket_info *lsi); +void frame_calculate_dynamic (struct frame *frame,const struct key_type *kt, +const struct options *options,const struct link_socket_info *lsi);/** * Checks and adjusts the fragment and mssfix value according to the
src/openvpn/mtcp.c +1 -1
@@ -91,7 +91,7 @@ }bool -multi_tcp_instance_specific_init (struct multi_context *m,struct multi_instance *mi) +multi_tcp_instance_specific_init (const struct multi_context *m,struct multi_instance *mi) {/* buffer for queued TCP socket output packets */ mi->tcp_link_out_deferred =mbuf_init (m->top.options.n_bcast_buf);
src/openvpn/mtcp.h +1 -1
@@ -35,7 +35,7 @@void multi_tcp_dereference_instance (struct multi_io *multi_io,struct multi_instance *mi); -bool multi_tcp_instance_specific_init (struct multi_context *m,struct multi_instance *mi); +bool multi_tcp_instance_specific_init (const struct multi_context *m,struct multi_instance *mi);void multi_tcp_instance_specific_free (struct multi_instance *mi);
src/openvpn/mudp.c +2 -2
@@ -39,7 +39,7 @@static void send_hmac_reset_packet (struct multi_context *m,struct tls_pre_decrypt_state *state, -struct tls_auth_standalone *tas,struct session_id *sid, +const struct tls_auth_standalone *tas,const struct session_id *sid,bool request_resend_wkc) {reset_packet_id_send (&state->tls_wrap_tmp.opt.packet_id.send);
@@ -69,7 +69,7 @@enum first_packet_verdict verdict; -struct tls_auth_standalone *tas = m->top.c2.tls_auth_standalone; +const struct tls_auth_standalone *tas = m->top.c2.tls_auth_standalone; verdict =tls_pre_decrypt_lite (tas, state, &m->top.c2.from, &m->top.c2.buf);
src/openvpn/multi.c +7 -7
@@ -1315,7 +1315,7 @@* same common name. */ static void -multi_delete_dup (struct multi_context *m,struct multi_instance *new_mi) +multi_delete_dup (struct multi_context *m,const struct multi_instance *new_mi) {if (new_mi) {
@@ -2260,7 +2260,7 @@ }static bool -multi_client_setup_dco_initial (struct multi_context *m,struct multi_instance *mi, +multi_client_setup_dco_initial (const struct multi_context *m,struct multi_instance *mi,struct gc_arena *gc) {if (!dco_enabled (&mi->context.options))
@@ -3195,7 +3195,7 @@#if defined(ENABLE_DCO )static void -process_incoming_del_peer (struct multi_context *m,struct multi_instance *mi,dco_context_t *dco) +process_incoming_del_peer (struct multi_context *m,struct multi_instance *mi,const dco_context_t *dco) {const char *reason ="ovpn-dco: unknown reason" ; switch (dco->dco_del_peer_reason)
@@ -4226,7 +4226,7 @@/* Searches for the address and deletes it if it is owned by the multi_instance */ static void -multi_unlearn_addr (struct multi_context *m,struct multi_instance *mi,const struct mroute_addr *addr) +multi_unlearn_addr (struct multi_context *m,const struct multi_instance *mi,const struct mroute_addr *addr) {struct hash_element *he;const uint32_t hv =hash_value (m->vhash, addr);
@@ -4261,7 +4261,7 @@* @param a The new IPv4 address in network byte order */ static void -multi_unlearn_in_addr_t (struct multi_context *m,struct multi_instance *mi,in_addr_t a) +multi_unlearn_in_addr_t (struct multi_context *m,const struct multi_instance *mi,in_addr_t a) {struct mroute_addr addr;CLEAR (addr);
@@ -4279,7 +4279,7 @@* @param a6 The new IPv6 address */ static void -multi_unlearn_in6_addr (struct multi_context *m,struct multi_instance *mi,struct in6_addr a6) +multi_unlearn_in6_addr (struct multi_context *m,const struct multi_instance *mi,struct in6_addr a6) {struct mroute_addr addr;CLEAR (addr);
@@ -4395,7 +4395,7 @@bool multi_check_push_ifconfig_ipv6_extra_route (struct multi_instance *mi, -struct in6_addr *dest) +const struct in6_addr *dest) {struct options *o = &mi->context.options;
src/openvpn/multi.h +2 -2
@@ -520,7 +520,7 @@*/ static inline void -set_prefix (struct multi_instance *mi) +set_prefix (const struct multi_instance *mi) {#ifdef MULTI_DEBUG_EVENT_LOOP if (mi->msg_prefix[0 ])
@@ -694,7 +694,7 @@*/ bool multi_check_push_ifconfig_ipv6_extra_route (struct multi_instance *mi, -struct in6_addr *dest); +const struct in6_addr *dest);/* * Check for signals.
src/openvpn/networking.h +1 -1
@@ -102,7 +102,7 @@* @return 0 on success, negative error code on error */ int net_iface_new (openvpn_net_ctx_t *ctx,const openvpn_net_iface_t *iface,const char *type, -void *arg); +const void *arg);/** * Retrieve the interface type
src/openvpn/networking_iproute2.c +1 -1
@@ -61,7 +61,7 @@ }int -net_iface_new (openvpn_net_ctx_t *ctx,const char *iface,const char *type,void *arg) +net_iface_new (openvpn_net_ctx_t *ctx,const char *iface,const char *type,const void *arg) {struct argv argv =argv_new ();
src/openvpn/networking_sitnl.c +4 -4
@@ -987,7 +987,7 @@ }static int -sitnl_addr_del (sa_family_t af_family,const char *iface,inet_address_t *addr,int prefixlen) +sitnl_addr_del (sa_family_t af_family,const char *iface,const inet_address_t *addr,int prefixlen) {int ifindex;
@@ -1230,8 +1230,8 @@ }static int -sitnl_route_del (const char *iface,sa_family_t af_family,inet_address_t *dst,int prefixlen, -inet_address_t *gw,uint32_t table,int metric) +sitnl_route_del (const char *iface,sa_family_t af_family,const inet_address_t *dst,int prefixlen, +const inet_address_t *gw,uint32_t table,int metric) {int ifindex =0 ;
@@ -1308,7 +1308,7 @@int -net_iface_new (openvpn_net_ctx_t *ctx,const char *iface,const char *type,void *arg) +net_iface_new (openvpn_net_ctx_t *ctx,const char *iface,const char *type,const void *arg) {struct sitnl_link_req req = {};int ret =-1 ;
src/openvpn/occ.h +1 -1
@@ -156,7 +156,7 @@* via control channel. * @return control channel exit message should be used */ static inline bool -cc_exit_notify_enabled (struct context *c) +cc_exit_notify_enabled (const struct context *c) {/* Check if we have TLS active at all */ if (!c->c2.tls_multi)
src/openvpn/openssl_compat.h +2 -2
@@ -124,7 +124,7 @@/* Mimics the functions but only when the default context without * options is chosen */ static inline const EVP_CIPHER * -EVP_CIPHER_fetch (void *ctx,const char *algorithm,const char *properties) +EVP_CIPHER_fetch (const void *ctx,const char *algorithm,const char *properties) {ASSERT (!ctx);ASSERT (!properties);
@@ -132,7 +132,7 @@ }static inline const EVP_MD * -EVP_MD_fetch (void *ctx,const char *algorithm,const char *properties) +EVP_MD_fetch (const void *ctx,const char *algorithm,const char *properties) {ASSERT (!ctx);ASSERT (!properties);
src/openvpn/options.c +3 -3
@@ -3050,7 +3050,7 @@ }static void -options_postprocess_mutate_le (struct connection_entry *ce,struct local_entry *le,int mode) +options_postprocess_mutate_le (const struct connection_entry *ce,struct local_entry *le,int mode) {/* use the global port if none is specified */ if (!le->port)
@@ -4980,7 +4980,7 @@static bool verify_permission (const char *name,const char *file,int line,const uint64_t type,const uint64_t allowed,uint64_t *found,const msglvl_t msglevel, -struct options *options,bool is_inline) +const struct options *options,bool is_inline) {if (!(type & allowed)) {
@@ -5547,7 +5547,7 @@ }static void -show_compression_warning (struct compress_options *info) +show_compression_warning (const struct compress_options *info) {if (comp_non_stub_enabled (info)) {
src/openvpn/options_parse.c +2 -2
@@ -258,7 +258,7 @@ }static char * -read_inline_file (struct in_src *is,const char *close_tag,int *num_lines,struct gc_arena *gc) +read_inline_file (const struct in_src *is,const char *close_tag,int *num_lines,struct gc_arena *gc) {char line[OPTION_LINE_SIZE ];struct buffer buf =alloc_buf (8 *OPTION_LINE_SIZE );
@@ -302,7 +302,7 @@ }static int -check_inline_file (struct in_src *is,char *p[],struct gc_arena *gc) +check_inline_file (const struct in_src *is,char *p[],struct gc_arena *gc) {int num_inline_lines =0 ;
src/openvpn/otime.c +1 -1
@@ -66,7 +66,7 @@ }void -update_now_usec (struct timeval *tv) +update_now_usec (const struct timeval *tv) {const time_t last = now;update_now (tv->tv_sec);
src/openvpn/otime.h +1 -1
@@ -65,7 +65,7 @@void update_now (const time_t system_time);extern time_t now_usec; -void update_now_usec (struct timeval *tv); +void update_now_usec (const struct timeval *tv);static inline int openvpn_gettimeofday (struct timeval *tv,void *tz)
src/openvpn/proto.h +1 -1
@@ -248,7 +248,7 @@* and offset of IP header (via parameter). */ static inline int -get_tun_ip_ver (int tunnel_type,struct buffer *buf,int *ip_hdr_offset) +get_tun_ip_ver (int tunnel_type,const struct buffer *buf,int *ip_hdr_offset) {int ip_ver =-1 ;
src/openvpn/proxy.c +2 -2
@@ -597,8 +597,8 @@socket_descriptor_t sd,/* already open to proxy */ const char *host, /* openvpn server remote */ const char *port, /* openvpn server port */ - struct event_timeout *server_poll_timeout, struct buffer *lookahead, - struct signal_info *sig_info) + const struct event_timeout *server_poll_timeout, + struct buffer *lookahead, struct signal_info *sig_info) { struct gc_arena gc = gc_new();char buf[512 ];
src/openvpn/proxy.h +1 -1
@@ -89,7 +89,7 @@socket_descriptor_t sd,/* already open to proxy */ const char *host, /* openvpn server remote */ const char *port, /* openvpn server port */ - struct event_timeout *server_poll_timeout, + const struct event_timeout *server_poll_timeout, struct buffer *lookahead, struct signal_info *sig_info);uint8_t *make_base64_string2 (const uint8_t *str,int str_len,struct gc_arena *gc);
src/openvpn/push.c +1 -1
@@ -435,7 +435,7 @@#endif bool -send_auth_pending_messages (struct tls_multi *tls_multi,struct tls_session *session, +send_auth_pending_messages (const struct tls_multi *tls_multi,struct tls_session *session,const char *extra,unsigned int timeout) {struct key_state *ks = &session->key[KS_PRIMARY ];
src/openvpn/push.h +1 -1
@@ -117,7 +117,7 @@* doc/management-notes.txt under client-pending-auth for * more details on message format */ -bool send_auth_pending_messages (struct tls_multi *tls_multi,struct tls_session *session, +bool send_auth_pending_messages (const struct tls_multi *tls_multi,struct tls_session *session,const char *extra,unsigned int timeout);void send_restart (struct context *c,const char *kill_msg);
src/openvpn/push_util.c +1 -1
@@ -222,7 +222,7 @@/* Return true if the client supports push-update */ static bool -support_push_update (struct multi_instance *mi) +support_push_update (const struct multi_instance *mi) {ASSERT (mi->context.c2.tls_multi);const unsigned int iv_proto_peer =extract_iv_proto (mi->context.c2.tls_multi->peer_info);
src/openvpn/reliable.c +3 -3
@@ -92,7 +92,7 @@/* check if a particular packet_id is present in ack */ static inline bool -reliable_ack_packet_id_present (struct reliable_ack *ack,packet_id_type pid) +reliable_ack_packet_id_present (const struct reliable_ack *ack,packet_id_type pid) {for (int i =0 ; i < ack->len; ++i) {
@@ -733,7 +733,7 @@*/ void -reliable_mark_active_incoming (struct reliable *rel,struct buffer *buf,packet_id_type pid, +reliable_mark_active_incoming (struct reliable *rel,const struct buffer *buf,packet_id_type pid,int opcode) {for (int i =0 ; i < rel->size; ++i)
@@ -793,7 +793,7 @@/* delete a buffer previously activated by reliable_mark_active() */ void -reliable_mark_deleted (struct reliable *rel,struct buffer *buf) +reliable_mark_deleted (struct reliable *rel,const struct buffer *buf) {for (int i =0 ; i < rel->size; ++i) {
src/openvpn/reliable.h +4 -4
@@ -173,7 +173,7 @@* @li False, if there are packet IDs to be acknowledged. */ static inline bool -reliable_ack_empty (struct reliable_ack *ack) +reliable_ack_empty (const struct reliable_ack *ack) {return !ack->len; }
@@ -186,7 +186,7 @@* @returns the number of outstanding acks */ static inline int -reliable_ack_outstanding (struct reliable_ack *ack) +reliable_ack_outstanding (const struct reliable_ack *ack) {return ack->len; }
@@ -336,7 +336,7 @@* @param pid The packet's packet ID. * @param opcode The packet's opcode. */ -void reliable_mark_active_incoming (struct reliable *rel,struct buffer *buf,packet_id_type pid, +void reliable_mark_active_incoming (struct reliable *rel,const struct buffer *buf,packet_id_type pid,int opcode);/**
@@ -389,7 +389,7 @@* @param rel The reliable structure associated with the given buffer. * @param buf The buffer of the reliable entry which is to be removed. */ -void reliable_mark_deleted (struct reliable *rel,struct buffer *buf); +void reliable_mark_deleted (struct reliable *rel,const struct buffer *buf);/** @} name Functions for extracting incoming packets */
src/openvpn/route.c +1 -1
@@ -3942,7 +3942,7 @@#else /* if defined(_WIN32) */ static void -get_bypass_addresses (struct route_bypass *rb,const unsigned int flags)/* PLATFORM-SPECIFIC */ +get_bypass_addresses (struct route_bypass *rb,const unsigned int flags) { }
src/openvpn/socket.c +4 -4
@@ -1125,8 +1125,8 @@* such as TCP. */ -static void stream_buf_init (struct stream_buf *sb,struct buffer *buf,const unsigned int sockflags, -const int proto); +static void stream_buf_init (struct stream_buf *sb,const struct buffer *buf, +const unsigned int sockflags,const int proto);static void stream_buf_close (struct stream_buf *sb);
@@ -2075,7 +2075,7 @@ }static void -stream_buf_init (struct stream_buf *sb,struct buffer *buf,const unsigned int sockflags, +stream_buf_init (struct stream_buf *sb,const struct buffer *buf,const unsigned int sockflags,const int proto) { sb->buf_init = *buf;
@@ -2464,7 +2464,7 @@#if ENABLE_IP_PKTINFO ssize_t -link_socket_write_udp_posix_sendmsg (struct link_socket *sock,struct buffer *buf, +link_socket_write_udp_posix_sendmsg (struct link_socket *sock,const struct buffer *buf,struct link_socket_actual *to) {struct iovec iov;
src/openvpn/socket.h +6 -4
@@ -484,7 +484,7 @@ }static inline bool -link_socket_verify_incoming_addr (struct buffer *buf,const struct link_socket_info *info, +link_socket_verify_incoming_addr (const struct buffer *buf,const struct link_socket_info *info,const struct link_socket_actual *from_addr) {if (buf->len >0 )
@@ -694,12 +694,12 @@#else /* ifdef _WIN32 */ -ssize_t link_socket_write_udp_posix_sendmsg (struct link_socket *sock,struct buffer *buf, +ssize_t link_socket_write_udp_posix_sendmsg (struct link_socket *sock,const struct buffer *buf,struct link_socket_actual *to);static inline ssize_t -link_socket_write_udp_posix (struct link_socket *sock,struct buffer *buf, +link_socket_write_udp_posix (struct link_socket *sock,const struct buffer *buf,struct link_socket_actual *to) {#if ENABLE_IP_PKTINFO
@@ -715,7 +715,7 @@ }static inline ssize_t -link_socket_write_tcp_posix (struct link_socket *sock,struct buffer *buf) +link_socket_write_tcp_posix (struct link_socket *sock,const struct buffer *buf) {return send (sock->sd,BPTR (buf),BLENZ (buf),MSG_NOSIGNAL ); }
@@ -819,6 +819,8 @@ } } +/* cppcheck-suppress constParameterPointer +* sock is modified on Windows via &sock->listen_handle */ static inline void socket_reset_listen_persistent (struct link_socket *sock) {
src/openvpn/socket_util.h +1 -1
@@ -439,7 +439,7 @@static inline bool -addrlist_match_proto (const struct openvpn_sockaddr *a1,struct addrinfo *addr_list,const int proto) +addrlist_match_proto (const struct openvpn_sockaddr *a1,const struct addrinfo *addr_list,const int proto) {return link_socket_proto_connection_oriented (proto) ?addrlist_match (a1, addr_list) :addrlist_port_match (a1, addr_list);
src/openvpn/socks.c +10 -10
@@ -82,7 +82,7 @@static bool socks_proxy_recv_char (uint8_t *c,const char *name,socket_descriptor_t sd, -struct event_timeout *server_poll_timeout, +const struct event_timeout *server_poll_timeout,volatile int *signal_received) {fd_set reads;
@@ -97,8 +97,8 @@ }static bool -socks_username_password_auth (struct socks_proxy_info *p,socket_descriptor_t sd, -struct event_timeout *server_poll_timeout, +socks_username_password_auth (const struct socks_proxy_info *p,socket_descriptor_t sd, +const struct event_timeout *server_poll_timeout,volatile int *signal_received) {char to_send[516 ];
@@ -156,8 +156,8 @@ }static bool -socks_handshake (struct socks_proxy_info *p,socket_descriptor_t sd, -struct event_timeout *server_poll_timeout,volatile int *signal_received) +socks_handshake (const struct socks_proxy_info *p,socket_descriptor_t sd, +const struct event_timeout *server_poll_timeout,volatile int *signal_received) {uint8_t buf[2 ];int len =0 ;
@@ -231,7 +231,7 @@static bool recv_socks_reply (socket_descriptor_t sd,struct openvpn_sockaddr *addr, -struct event_timeout *server_poll_timeout,volatile int *signal_received) +const struct event_timeout *server_poll_timeout,volatile int *signal_received) {uint8_t atyp =0 ;int alen =0 ;
@@ -334,11 +334,11 @@ }void -establish_socks_proxy_passthru (struct socks_proxy_info *p, +establish_socks_proxy_passthru (const struct socks_proxy_info *p,socket_descriptor_t sd,/* already open to proxy */ const char *host,/* openvpn server remote */ const char *servname,/* openvpn server port */ -struct event_timeout *server_poll_timeout, +const struct event_timeout *server_poll_timeout,struct signal_info *sig_info) {char buf[270 ];
@@ -392,10 +392,10 @@ }void -establish_socks_proxy_udpassoc (struct socks_proxy_info *p, +establish_socks_proxy_udpassoc (const struct socks_proxy_info *p,socket_descriptor_t ctrl_sd,/* already open to proxy */ struct openvpn_sockaddr *relay_addr, -struct event_timeout *server_poll_timeout, +const struct event_timeout *server_poll_timeout,struct signal_info *sig_info) {if (!socks_handshake (p, ctrl_sd, server_poll_timeout, &sig_info->signal_received))
src/openvpn/socks.h +4 -4
@@ -47,17 +47,17 @@void socks_proxy_close (struct socks_proxy_info *sp); -void establish_socks_proxy_passthru (struct socks_proxy_info *p, +void establish_socks_proxy_passthru (const struct socks_proxy_info *p,socket_descriptor_t sd,/* already open to proxy */ const char *host,/* openvpn server remote */ const char *servname,/* openvpn server port */ -struct event_timeout *server_poll_timeout, +const struct event_timeout *server_poll_timeout,struct signal_info *sig_info); -void establish_socks_proxy_udpassoc (struct socks_proxy_info *p, +void establish_socks_proxy_udpassoc (const struct socks_proxy_info *p,socket_descriptor_t ctrl_sd,/* already open to proxy */ struct openvpn_sockaddr *relay_addr, -struct event_timeout *server_poll_timeout, +const struct event_timeout *server_poll_timeout,struct signal_info *sig_info);void socks_process_incoming_udp (struct buffer *buf,struct link_socket_actual *from);
src/openvpn/ssl.c +12 -11
@@ -1159,7 +1159,7 @@ }struct tls_multi * -tls_multi_init (struct tls_options *tls_options) +tls_multi_init (const struct tls_options *tls_options) {struct tls_multi *ret;
@@ -1188,7 +1188,7 @@*/ struct tls_auth_standalone * -tls_auth_standalone_init (struct tls_options *tls_options,struct gc_arena *gc) +tls_auth_standalone_init (const struct tls_options *tls_options,struct gc_arena *gc) {struct tls_auth_standalone *tas;
@@ -1336,7 +1336,7 @@static void init_epoch_keys (struct key_state *ks,struct tls_multi *multi,const struct key_type *key_type, -bool server,struct key2 *key2) +bool server,const struct key2 *key2) {/* For now we hardcode this to be 16 for the software based data channel * DCO based implementations/HW implementation might adjust this number
@@ -1375,7 +1375,7 @@static void init_key_contexts (struct key_state *ks,struct tls_multi *multi,const struct key_type *key_type, -bool server,struct key2 *key2,bool dco_enabled) +bool server,const struct key2 *key2,bool dco_enabled) {struct key_ctx_bi *key = &ks->crypto_options.key_ctx_bi;
@@ -1573,8 +1573,9 @@bool tls_session_update_crypto_params_do_work (struct tls_multi *multi,struct tls_session *session, -struct options *options,struct frame *frame, -struct frame *frame_fragment,struct link_socket_info *lsi, +const struct options *options,struct frame *frame, +struct frame *frame_fragment, +const struct link_socket_info *lsi,dco_context_t *dco) {if (session->key[KS_PRIMARY ].crypto_options.key_ctx_bi.initialized)
@@ -1643,7 +1644,7 @@bool tls_session_update_crypto_params (struct tls_multi *multi,struct tls_session *session,struct options *options,struct frame *frame, -struct frame *frame_fragment,struct link_socket_info *lsi, +struct frame *frame_fragment,const struct link_socket_info *lsi,dco_context_t *dco) {if (!check_session_cipher (session, options))
@@ -2495,8 +2496,8 @@ }bool -session_skip_to_pre_start (struct tls_session *session,struct tls_pre_decrypt_state *state, -struct link_socket_actual *from) +session_skip_to_pre_start (struct tls_session *session,const struct tls_pre_decrypt_state *state, +const struct link_socket_actual *from) {struct key_state *ks = &session->key[KS_PRIMARY ]; ks->session_id_remote = state->peer_session_id;
@@ -4011,7 +4012,7 @@ }void -tls_post_encrypt (struct tls_multi *multi,struct buffer *buf) +tls_post_encrypt (struct tls_multi *multi,const struct buffer *buf) {struct key_state *ks = multi->save_ks; multi->save_ks =NULL ;
@@ -4142,7 +4143,7 @@* into a garbage collectable string which is returned. */ const char * -protocol_dump (struct buffer *buffer,unsigned int flags,struct gc_arena *gc) +protocol_dump (const struct buffer *buffer,unsigned int flags,struct gc_arena *gc) {struct buffer out =alloc_buf_gc (256 , gc);struct buffer buf = *buffer;
src/openvpn/ssl.h +8 -7
@@ -166,7 +166,7 @@* * @return A newly allocated and initialized \c tls_multi structure. */ -struct tls_multi *tls_multi_init (struct tls_options *tls_options); +struct tls_multi *tls_multi_init (const struct tls_options *tls_options);/** * Finalize initialization of a \c tls_multi structure.
@@ -187,7 +187,7 @@/* * Initialize a standalone tls-auth verification object. */ -struct tls_auth_standalone *tls_auth_standalone_init (struct tls_options *tls_options, +struct tls_auth_standalone *tls_auth_standalone_init (const struct tls_options *tls_options,struct gc_arena *gc);/**
@@ -371,7 +371,7 @@* @param multi - The TLS state for this packet's destination VPN tunnel. * @param buf - The buffer containing the outgoing packet. */ -void tls_post_encrypt (struct tls_multi *multi,struct buffer *buf); +void tls_post_encrypt (struct tls_multi *multi,const struct buffer *buf);/** @} name Functions for managing security parameter state for data channel packets */
@@ -461,7 +461,8 @@*/ bool tls_session_update_crypto_params (struct tls_multi *multi,struct tls_session *session,struct options *options,struct frame *frame, -struct frame *frame_fragment,struct link_socket_info *lsi, +struct frame *frame_fragment, +const struct link_socket_info *lsi,dco_context_t *dco);/*
@@ -525,7 +526,7 @@#define PD_VERBOSE (1 << 10)#define PD_TLS_CRYPT (1 << 11) -const char *protocol_dump (struct buffer *buffer,unsigned int flags,struct gc_arena *gc); +const char *protocol_dump (const struct buffer *buffer,unsigned int flags,struct gc_arena *gc);/* * debugging code
@@ -573,7 +574,7 @@/* Special method to skip the three way handshake RESET stages. This is * used by the HMAC code when seeing a packet that matches the previous * HMAC based stateless server state */ -bool session_skip_to_pre_start (struct tls_session *session,struct tls_pre_decrypt_state *state, -struct link_socket_actual *from); +bool session_skip_to_pre_start (struct tls_session *session,const struct tls_pre_decrypt_state *state, +const struct link_socket_actual *from);#endif /* ifndef OPENVPN_SSL_H */
src/openvpn/ssl_backend.h +2 -2
@@ -144,7 +144,7 @@* * @return true if the context is initialised, false if not. */ -bool tls_ctx_initialised (struct tls_root_ctx *ctx); +bool tls_ctx_initialised (const struct tls_root_ctx *ctx);/** * Set any library specific options.
@@ -177,7 +177,7 @@* @param ciphers String containing : delimited cipher names, or NULL to use * sane defaults. */ -void tls_ctx_restrict_ciphers_tls13 (struct tls_root_ctx *ctx,const char *ciphers); +void tls_ctx_restrict_ciphers_tls13 (const struct tls_root_ctx *ctx,const char *ciphers);/** * Set the TLS certificate profile. The profile defines which crypto
src/openvpn/ssl_mbedtls.c +2 -2
@@ -161,7 +161,7 @@ }bool -tls_ctx_initialised (struct tls_root_ctx *ctx) +tls_ctx_initialised (const struct tls_root_ctx *ctx) {/* either this should be NULL or should be non-null and then have a * valid TLS ctx inside as well */
@@ -284,7 +284,7 @@ }void -tls_ctx_restrict_ciphers_tls13 (struct tls_root_ctx *ctx,const char *ciphers) +tls_ctx_restrict_ciphers_tls13 (const struct tls_root_ctx *ctx,const char *ciphers) {if (ciphers ==NULL ) {
src/openvpn/ssl_openssl.c +3 -3
@@ -147,7 +147,7 @@ }bool -tls_ctx_initialised (struct tls_root_ctx *ctx) +tls_ctx_initialised (const struct tls_root_ctx *ctx) {/* either this should be NULL or should be non-null and then have a * valid TLS ctx inside as well */
@@ -509,7 +509,7 @@#endif void -tls_ctx_restrict_ciphers_tls13 (struct tls_root_ctx *ctx,const char *ciphers) +tls_ctx_restrict_ciphers_tls13 (const struct tls_root_ctx *ctx,const char *ciphers) {if (ciphers ==NULL ) {
@@ -1165,7 +1165,7 @@ }static void -tls_ctx_load_cert_uri (struct tls_root_ctx *tls_ctx,const char *uri) +tls_ctx_load_cert_uri (const struct tls_root_ctx *tls_ctx,const char *uri) {#if defined(HAVE_OPENSSL_STORE_API )X509 *x =NULL ;
src/openvpn/ssl_pkt.c +5 -5
@@ -57,7 +57,7 @@* @return if the swap was successful (buf was large enough) */ static bool -swap_hmac (struct buffer *buf,const struct crypto_options *co,bool incoming) +swap_hmac (const struct buffer *buf,const struct crypto_options *co,bool incoming) {ASSERT (co);
@@ -117,7 +117,7 @@*/ static void tls_wrap_control (struct tls_wrap_ctx *ctx,uint8_t header,struct buffer *buf, -struct session_id *session_id) +const struct session_id *session_id) {if (ctx->mode ==TLS_WRAP_AUTH || ctx->mode ==TLS_WRAP_NONE ) {
@@ -403,9 +403,9 @@struct buffer -tls_reset_standalone (struct tls_wrap_ctx *ctx,struct tls_auth_standalone *tas, -struct session_id *own_sid,struct session_id *remote_sid,uint8_t header, -bool request_resend_wkc) +tls_reset_standalone (struct tls_wrap_ctx *ctx,const struct tls_auth_standalone *tas, +const struct session_id *own_sid,const struct session_id *remote_sid, +uint8_t header,bool request_resend_wkc) {/* Copy buffer here to point at the same data but allow tls_wrap_control * to potentially change buf to point to another buffer without
src/openvpn/ssl_pkt.h +3 -2
@@ -220,8 +220,9 @@* from the tls pre decrypt state. * */ -struct buffer tls_reset_standalone (struct tls_wrap_ctx *ctx,struct tls_auth_standalone *tas, -struct session_id *own_sid,struct session_id *remote_sid, +struct buffer tls_reset_standalone (struct tls_wrap_ctx *ctx,const struct tls_auth_standalone *tas, +const struct session_id *own_sid, +const struct session_id *remote_sid,uint8_t header,bool request_resend_wkc);
src/openvpn/ssl_verify.c +4 -4
@@ -1137,7 +1137,7 @@* cache. */ static bool -tls_authentication_status_use_cache (struct tls_multi *multi) +tls_authentication_status_use_cache (const struct tls_multi *multi) {unsigned int idx =min_uint (multi->tas_cache_num_updates,SIZE (cache_intervals) -1 );time_t latency = cache_intervals[idx];
@@ -1281,7 +1281,7 @@* Check if the script/plugin left a message in the auth failed message * file and relay it to the user */ static void -check_for_client_reason (struct tls_multi *multi,struct auth_deferred_status *status) +check_for_client_reason (struct tls_multi *multi,const struct auth_deferred_status *status) {struct gc_arena gc =gc_new ();const char *msg =key_state_check_auth_failed_message_file (status, &gc);
@@ -1550,7 +1550,7 @@#endif /* ifdef ENABLE_MANAGEMENT */ static bool -set_verify_user_pass_env (struct user_pass *up,struct tls_multi *multi,struct tls_session *session) +set_verify_user_pass_env (const struct user_pass *up,struct tls_multi *multi,struct tls_session *session) {/* Is username defined? */ if ((session->opt->ssl_flags &SSLF_AUTH_USER_PASS_OPTIONAL ) ||strlen (up->username))
@@ -1578,7 +1578,7 @@ }bool -ssl_verify_username_length (struct tls_session *session,const char *username) +ssl_verify_username_length (const struct tls_session *session,const char *username) {if ((session->opt->ssl_flags &SSLF_USERNAME_AS_COMMON_NAME ) &&strlen (username) >TLS_USERNAME_LEN )
src/openvpn/ssl_verify.h +2 -2
@@ -202,7 +202,7 @@* @return true if name is under limit or username-as-common-name * is not active */ -bool ssl_verify_username_length (struct tls_session *session,const char *username); +bool ssl_verify_username_length (const struct tls_session *session,const char *username);/** * Runs the --client-crresponse script if one is defined.
@@ -275,7 +275,7 @@void auth_set_client_reason (struct tls_multi *multi,const char *client_reason);static inline const char * -tls_client_reason (struct tls_multi *multi) +tls_client_reason (const struct tls_multi *multi) {return multi->client_reason; }
src/openvpn/tun.c +1 -1
@@ -1808,7 +1808,7 @@#if defined(TARGET_LINUX ) || defined(TARGET_FREEBSD )static bool -tun_dco_enabled (struct tuntap *tt) +tun_dco_enabled (const struct tuntap *tt) {return tt->backend_driver ==DRIVER_DCO ; }
src/openvpn/tun.h +6 -6
@@ -351,7 +351,7 @@#define IFCONFIG_DEFAULT IFCONFIG_AFTER_TUN_OPENstatic inline int -ifconfig_order (struct tuntap *tt) +ifconfig_order (const struct tuntap *tt) {if (tt->backend_driver ==DRIVER_AFUNIX ) {
@@ -381,7 +381,7 @@#define ROUTE_ORDER_DEFAULT ROUTE_AFTER_TUNstatic inline int -route_order (struct tuntap *tt) +route_order (const struct tuntap *tt) {if (tt->backend_driver ==DRIVER_AFUNIX ) {
@@ -555,25 +555,25 @@ }static inline void -tun_standby_init (struct tuntap *tt) +tun_standby_init (const struct tuntap *tt) { }static inline bool -tun_standby (struct tuntap *tt) +tun_standby (const struct tuntap *tt) {return true; }static inline bool -tuntap_is_dco_win (struct tuntap *tt) +tuntap_is_dco_win (const struct tuntap *tt) {return false; }static inline bool -tuntap_is_dco_win_timeout (struct tuntap *tt,int status) +tuntap_is_dco_win_timeout (const struct tuntap *tt,int status) {return false; }
src/openvpn/tun_afunix.c +2 -2
@@ -48,7 +48,7 @@static void -tun_afunix_exec_child (const char *dev_node,struct tuntap *tt,struct env_set *env) +tun_afunix_exec_child (const char *dev_node,struct tuntap *tt,const struct env_set *env) {const char *msgprefix ="ERROR: failure executing process for tun:" ;struct argv argv =argv_new ();
@@ -73,7 +73,7 @@ }void -open_tun_afunix (struct options *o,int mtu,struct tuntap *tt,struct env_set *orig_env) +open_tun_afunix (const struct options *o,int mtu,struct tuntap *tt,const struct env_set *orig_env) {struct gc_arena gc =gc_new ();
src/openvpn/tun_afunix.h +1 -1
@@ -31,7 +31,7 @@* the user provided taking care of implementing the actual tun * device. */ -void open_tun_afunix (struct options *o,int mtu,struct tuntap *tt,struct env_set *env); +void open_tun_afunix (const struct options *o,int mtu,struct tuntap *tt,const struct env_set *env);/**
src/openvpn/vlan.c +1 -1
@@ -288,7 +288,7 @@ }void -vlan_process_outgoing_tun (struct multi_context *m,struct multi_instance *mi) +vlan_process_outgoing_tun (const struct multi_context *m,struct multi_instance *mi) {if (!m->top.options.vlan_tagging) {
src/openvpn/vlan.h +1 -1
@@ -35,6 +35,6 @@bool vlan_is_tagged (const struct buffer *buf); -void vlan_process_outgoing_tun (struct multi_context *m,struct multi_instance *mi); +void vlan_process_outgoing_tun (const struct multi_context *m,struct multi_instance *mi);#endif /* VLAN_H */
src/openvpnmsica/openvpnmsica.c +1 -1
@@ -77,7 +77,7 @@* @return ERROR_SUCCESS on success; An error code otherwise */ static UINT -setup_sequence(_In_ MSIHANDLE hInstall, _In_z_ LPCWSTR szProperty, _In_ struct msica_arg_seq *seq) +setup_sequence(_In_ MSIHANDLE hInstall, _In_z_ LPCWSTR szProperty, _In_ const struct msica_arg_seq *seq) {UINT uiResult;LPWSTR szSequence =msica_arg_seq_join (seq);
src/openvpnserv/interactive.c +2 -2
@@ -521,7 +521,7 @@static SOCKADDR_INET -sockaddr_inet (short family,inet_address_t *addr) +sockaddr_inet (short family,const inet_address_t *addr) {SOCKADDR_INET sa_inet;ZeroMemory (&sa_inet,sizeof (sa_inet));
@@ -3722,7 +3722,7 @@static DWORD UpdateWaitHandles (LPHANDLE *handles_ptr,LPDWORD count,HANDLE io_event,HANDLE exit_event, -list_item_t *threads) +const list_item_t *threads) {static DWORD size =10 ;static LPHANDLE handles =NULL ;
tests/t_client.sh.in +0 -5
@@ -62,11 +62,6 @@ exit 1 fi -if [ -z "$CA_CERT" ] ; then - echo "CA_CERT not defined in 't_client.rc'. SKIP test." >&2 - exit "${TCLIENT_SKIP_RC}" -fi - if [ -z "$TEST_RUN_LIST" ] ; then echo "TEST_RUN_LIST empty, no tests defined. SKIP test." >&2 exit "${TCLIENT_SKIP_RC}"
tests/unit_tests/openvpn/mock_management.c +1 -1
@@ -36,7 +36,7 @@struct management *management;/* GLOBAL */ void -management_auth_failure (struct management *man,const char *type,const char *reason) +management_auth_failure (const struct management *man,const char *type,const char *reason) {ASSERT (false); }
tests/unit_tests/openvpn/test_misc.c +1 -1
@@ -146,7 +146,7 @@ }static struct hash_element * -hash_lookup_by_value (struct hash *hash,void *value) +hash_lookup_by_value (struct hash *hash,const void *value) {struct hash_iterator hi;struct hash_element *he;
tests/unit_tests/openvpn/test_user_pass.c +1 -1
@@ -59,7 +59,7 @@return mock (); }void -management_auth_failure (struct management *man,const char *type,const char *reason) +management_auth_failure (const struct management *man,const char *type,const char *reason) {assert_true (0 ); }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1663?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I56248cf6d199c2da770774b8fd1e5daf2b116f58
Gerrit-Change-Number: 1663
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1663?usp=email
to look at the new patch set (#2).
Change subject: Remove instances of constParameterPointer cppcheck warnings
......................................................................
Remove instances of constParameterPointer cppcheck warnings
This requires a few suppressions since cppcheck
doesn't quite understand the different code-paths
implemented by preprocessor defines.
---
M dev-tools/cppcheck-suppression
M sample/sample-plugins/client-connect/sample-client-connect.c
M sample/sample-plugins/defer/multi-auth.c
M sample/sample-plugins/keying-material-exporter-demo/keyingmaterialexporter.c M src/openvpn/buffer.c
M src/openvpn/buffer.h
M src/openvpn/clinat.c
M src/openvpn/clinat.h
M src/openvpn/comp.c
M src/openvpn/comp.h
M src/openvpn/crypto.c
M src/openvpn/crypto.h
M src/openvpn/dco.c
M src/openvpn/dco.h
M src/openvpn/dco_freebsd.c
M src/openvpn/dco_internal.h
M src/openvpn/dco_linux.c
M src/openvpn/dco_win.c
M src/openvpn/dhcp.c
M src/openvpn/dhcp.h
M src/openvpn/event.h
M src/openvpn/forward.c
M src/openvpn/forward.h
M src/openvpn/init.c
M src/openvpn/init.h
M src/openvpn/interval.h
M src/openvpn/list.c
M src/openvpn/list.h
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/mbuf.c
M src/openvpn/mbuf.h
M src/openvpn/mss.c
M src/openvpn/mss.h
M src/openvpn/mtcp.c
M src/openvpn/mtcp.h
M src/openvpn/mudp.c
M src/openvpn/multi.c
M src/openvpn/multi.h
M src/openvpn/networking.h
M src/openvpn/networking_iproute2.c
M src/openvpn/networking_sitnl.c
M src/openvpn/occ.h
M src/openvpn/openssl_compat.h
M src/openvpn/options.c
M src/openvpn/options_parse.c
M src/openvpn/otime.c
M src/openvpn/otime.h
M src/openvpn/proto.h
M src/openvpn/proxy.c
M src/openvpn/proxy.h
M src/openvpn/push.c
M src/openvpn/push.h
M src/openvpn/push_util.c
M src/openvpn/reliable.c
M src/openvpn/reliable.h
M src/openvpn/route.c
M src/openvpn/schedule.c
M src/openvpn/socket.c
M src/openvpn/socket.h
M src/openvpn/socket_util.h
M src/openvpn/socks.c
M src/openvpn/socks.h
M src/openvpn/ssl.c
M src/openvpn/ssl.h
M src/openvpn/ssl_backend.h
M src/openvpn/ssl_mbedtls.c
M src/openvpn/ssl_openssl.c
M src/openvpn/ssl_pkt.c
M src/openvpn/ssl_pkt.h
M src/openvpn/ssl_verify.c
M src/openvpn/ssl_verify.h
M src/openvpn/tun.c
M src/openvpn/tun.h
M src/openvpn/tun_afunix.c
M src/openvpn/tun_afunix.h
M src/openvpn/vlan.c
M src/openvpn/vlan.h
M src/openvpn/win32.h
M src/openvpnmsica/openvpnmsica.c
M src/openvpnserv/interactive.c
M tests/unit_tests/openvpn/mock_management.c
M tests/unit_tests/openvpn/test_misc.c
M tests/unit_tests/openvpn/test_user_pass.c
84 files changed, 286 insertions(+), 246 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/63/1663/2
dev-tools/cppcheck-suppression +32 -1
@@ -2,7 +2,6 @@ # occurences right now. They still should be fixed at some point constParameter constParameterCallback -constParameterPointer variableScope # We have a lot of library includes, not all of them are really required, # so ignore them
@@ -22,6 +21,38 @@ badBitmaskCheck:tests/unit_tests/openvpn/test_pkt.c # IGN: we store integers in pointers CastAddressToIntegerAtReturn:src/openvpn/multi.c +constParameterPointer:/usr/include/* +# IGN: test files provide mocks/stubs that match prototypes from headers exactly +constParameterPointer:tests/unit_tests/openvpn/mock_* +constParameterPointer:tests/unit_tests/openvpn/test_* +constParameterPointer:tests/unit_tests/openvpnserv/test_* +# FP: different crypto implementations but same API +constParameterPointer:src/openvpn/crypto_mbedtls_legacy.c:85 +constParameterPointer:src/openvpn/crypto_openssl.c:172 +constParameterPointer:src/openvpn/crypto_openssl.c:1456 +constParameterPointer:src/openvpn/cryptoapi.c:58 +constParameterPointer:src/openvpn/ssl_mbedtls.c +constParameterPointer:src/openvpn/ssl_openssl.c +constParameterPointer:src/openvpn/ssl_verify_mbedtls.c +# IGN: too many different implementations, not worth it +constParameterPointer:src/openvpn/dco* +# FP: parameters are modified on some platform only +constParameterPointer:src/openvpn/dns.c:859 +constParameterPointer:src/openvpn/error.c:223 +constParameterPointer:src/openvpn/manage.c:344 +constParameterPointer:src/openvpn/manage.c:3332 +constParameterPointer:src/openvpn/misc.c:792 +constParameterPointer:src/openvpn/misc.c:812 +constParameterPointer:src/openvpn/options.c:3205 +constParameterPointer:src/openvpn/route.c:3947 +constParameterPointer:src/openvpn/socket.c:2244 +constParameterPointer:src/openvpn/socket.h:726 +constParameterPointer:src/openvpn/socket.h:825 +constParameterPointer:src/openvpn/tun.c:560 +constParameterPointer:src/openvpn/tun.c:2188 +constParameterPointer:src/openvpn/tun_afunix.c +# FP: local is modified via cast inside function +constParameterPointer:src/openvpn/dco.c:560 # IGN: event code uses a pointer to store integers intToPointerCast:src/openvpn/multi_io.c intToPointerCast:src/openvpn/forward.c
sample/sample-plugins/client-connect/sample-client-connect.c +2 -2
@@ -344,7 +344,7 @@ }int -openvpn_plugin_client_connect (struct plugin_context *context,const char **argv,const char **envp) +openvpn_plugin_client_connect (const struct plugin_context *context,const char **argv,const char **envp) {/* log environment variables handed to us by OpenVPN, but * only if "setenv verb" is 3 or higher (arbitrary number)
@@ -465,7 +465,7 @@int openvpn_plugin_client_connect_defer_v2 (struct plugin_context *context, -struct plugin_per_client_context *pcc, +const struct plugin_per_client_context *pcc,struct openvpn_plugin_string_list **return_list) {time_t time_left = pcc->sleep_until -time (NULL );
sample/sample-plugins/defer/multi-auth.c +1 -1
@@ -255,7 +255,7 @@ }static bool -do_auth_user_pass (struct plugin_context *context,const char *username,const char *password) +do_auth_user_pass (const struct plugin_context *context,const char *username,const char *password) {plog (context,PLOG_NOTE ,"expect_user=%s, received_user=%s, expect_passw=%s, received_passw=%s" ,np (context->test_valid_user),np (username),np (context->test_valid_pass),np (password));
sample/sample-plugins/keying-material-exporter-demo/keyingmaterialexporter.c +3 -3
@@ -186,7 +186,7 @@ }static void -file_store (char *file,char *content) +file_store (const char *file,const char *content) {FILE *f;if (!(f =fopen (file,"w+" )))
@@ -202,7 +202,7 @@ server_store(struct openvpn_plugin_args_func_in const *args) {struct plugin *plugin = (struct plugin *)args->handle; -struct session *sess = (struct session *)args->per_client_context; +const struct session *sess = (struct session *)args->per_client_context;char file[MAXPATH ];snprintf (file,sizeof (file) -1 ,"/tmp/openvpn_sso_%s" , sess->key);
@@ -214,7 +214,7 @@ client_store(struct openvpn_plugin_args_func_in const *args) {struct plugin *plugin = (struct plugin *)args->handle; -struct session *sess = (struct session *)args->per_client_context; +const struct session *sess = (struct session *)args->per_client_context;char *file ="/tmp/openvpn_sso_user" ;ovpn_note ("app session file: %s" , file);
src/openvpn/buffer.c +2 -2
@@ -290,7 +290,7 @@* truncated by buf_printf */ void -buf_catrunc (struct buffer *buf,const char *str) +buf_catrunc (const struct buffer *buf,const char *str) {if (buf_forward_capacity (buf) <=1 ) {
@@ -1091,7 +1091,7 @@ }bool -string_check_buf (struct buffer *buf,const unsigned int inclusive,const unsigned int exclusive) +string_check_buf (const struct buffer *buf,const unsigned int inclusive,const unsigned int exclusive) {ASSERT (buf);
src/openvpn/buffer.h +4 -4
@@ -487,7 +487,7 @@* write a string to the end of a buffer that was * truncated by buf_printf */ -void buf_catrunc (struct buffer *buf,const char *str); +void buf_catrunc (const struct buffer *buf,const char *str);/* * Parse a string based on a given delimiter char
@@ -774,7 +774,7 @@ }static inline int -buf_peek_u8 (struct buffer *buf) +buf_peek_u8 (const struct buffer *buf) {int ret;if (BLEN (buf) <1 )
@@ -923,7 +923,7 @@* @param exclusive Character classes that are not allowed even if they are also in inclusive. * @return True if the string consists only of allowed characters, false otherwise. */ -bool string_check_buf (struct buffer *buf,const unsigned int inclusive, +bool string_check_buf (const struct buffer *buf,const unsigned int inclusive,const unsigned int exclusive);/**
@@ -1102,7 +1102,7 @@ }static inline void -check_malloc_return (void *p) +check_malloc_return (const void *p) {if (!p) {
src/openvpn/clinat.c +2 -2
@@ -159,7 +159,7 @@#endif static void -print_pkt (struct openvpn_iphdr *iph,const char *prefix,const int direction,const msglvl_t msglevel) +print_pkt (const struct openvpn_iphdr *iph,const char *prefix,const int direction,const msglvl_t msglevel) {struct gc_arena gc =gc_new ();
@@ -181,7 +181,7 @@ }void -client_nat_transform (const struct client_nat_option_list *list,struct buffer *ipbuf, +client_nat_transform (const struct client_nat_option_list *list,const struct buffer *ipbuf,const int direction) {struct ip_tcp_udp_hdr *h = (struct ip_tcp_udp_hdr *)BPTR (ipbuf);
src/openvpn/clinat.h +1 -1
@@ -60,7 +60,7 @@ const char *network, const char *netmask, const char *foreign_network, msglvl_t msglevel); -void client_nat_transform (const struct client_nat_option_list *list,struct buffer *ipbuf, +void client_nat_transform (const struct client_nat_option_list *list,const struct buffer *ipbuf,const int direction);#endif /* if !defined(CLINAT_H) */
src/openvpn/comp.c +1 -1
@@ -159,7 +159,7 @@#endif /* USE_COMP */ bool -check_compression_settings_valid (struct compress_options *info,msglvl_t msglevel) +check_compression_settings_valid (const struct compress_options *info,msglvl_t msglevel) {/* * We also allow comp-stub-v2 here as it technically allows escaping of
src/openvpn/comp.h +1 -1
@@ -91,7 +91,7 @@* flags of allow-compression and also the whether algorithms are compiled * in */ -bool check_compression_settings_valid (struct compress_options *info,msglvl_t msglevel); +bool check_compression_settings_valid (const struct compress_options *info,msglvl_t msglevel);#ifdef USE_COMP #include "buffer.h"
src/openvpn/crypto.c +3 -3
@@ -1105,7 +1105,7 @@ }static bool -key_is_zero (struct key *key,const struct key_type *kt) +key_is_zero (const struct key *key,const struct key_type *kt) {size_t cipher_length =cipher_kt_key_size (kt->cipher);for (size_t i =0 ; i < cipher_length; ++i)
@@ -1123,7 +1123,7 @@* Make sure that cipher key is a valid key for current key_type. */ bool -check_key (struct key *key,const struct key_type *kt) +check_key (const struct key *key,const struct key_type *kt) {if (cipher_defined (kt->cipher)) {
@@ -1196,7 +1196,7 @@ }void -test_crypto (struct crypto_options *co,struct frame *frame) +test_crypto (struct crypto_options *co,const struct frame *frame) {int i, j;struct gc_arena gc =gc_new ();
src/openvpn/crypto.h +2 -2
@@ -414,7 +414,7 @@*/ int write_key_file (const int nkeys,const char *filename); -bool check_key (struct key *key,const struct key_type *kt); +bool check_key (const struct key *key,const struct key_type *kt);/** * Initialize a key_type structure with.
@@ -609,7 +609,7 @@/** Print a cipher list entry */ void print_cipher (const char *cipher); -void test_crypto (struct crypto_options *co,struct frame *f); +void test_crypto (struct crypto_options *co,const struct frame *f);/* key direction functions */
src/openvpn/dco.c +5 -5
@@ -556,7 +556,7 @@ }static bool -dco_multi_get_localaddr (struct multi_context *m,struct multi_instance *mi, +dco_multi_get_localaddr (const struct multi_context *m,const struct multi_instance *mi,struct sockaddr_storage *local) {#if ENABLE_IP_PKTINFO
@@ -568,7 +568,7 @@return false; } -struct link_socket_actual *actual = &c->c2.link_socket_infos[0 ]->lsa->actual; +const struct link_socket_actual *actual = &c->c2.link_socket_infos[0 ]->lsa->actual;switch (actual->dest.addr.sa.sa_family) {
@@ -606,7 +606,7 @@ }int -dco_multi_add_new_peer (struct multi_context *m,struct multi_instance *mi) +dco_multi_add_new_peer (const struct multi_context *m,struct multi_instance *mi) {const struct context *c = &mi->context;
@@ -660,7 +660,7 @@ }void -dco_install_iroute (struct multi_context *m,struct multi_instance *mi,struct mroute_addr *addr) +dco_install_iroute (struct multi_context *m,struct multi_instance *mi,const struct mroute_addr *addr) {#if defined(TARGET_LINUX ) || defined(TARGET_FREEBSD ) || defined(_WIN32)if (!dco_enabled (&m->top.options))
@@ -779,7 +779,7 @@/* Checked if we added a host route as the assigned client IP address was * outside the --ifconfig-ipv6 tun interface config */ #if !defined(_WIN32) -struct in6_addr *dest = &mi->context.c2.push_ifconfig_ipv6_local; +const struct in6_addr *dest = &mi->context.c2.push_ifconfig_ipv6_local;if (multi_check_push_ifconfig_ipv6_extra_route (mi, dest)) {/* On windows we do not install these routes, so we also do not need to delete them */
src/openvpn/dco.h +6 -6
@@ -204,7 +204,7 @@* @param mi the client instance * @return 0 on success or a negative error code otherwise */ -int dco_multi_add_new_peer (struct multi_context *m,struct multi_instance *mi); +int dco_multi_add_new_peer (const struct multi_context *m,struct multi_instance *mi);/** * Install an iroute in DCO, which means adding a route to the system routing
@@ -215,7 +215,7 @@* @param addr the route to add */ void dco_install_iroute (struct multi_context *m,struct multi_instance *mi, -struct mroute_addr *addr); +const struct mroute_addr *addr);/** * Remove all routes added through the specified client
@@ -253,7 +253,7 @@* a 64 bit packet counter and AEAD tag at the end. */ bool -dco_supports_epoch_data (struct context *c); +dco_supports_epoch_data (const struct context *c);#else /* if defined(ENABLE_DCO) */ typedef void *dco_context_t ;
@@ -313,7 +313,7 @@ }static inline void -dco_event_set (dco_context_t *dco,struct event_set *es,void *arg) +dco_event_set (const dco_context_t *dco,struct event_set *es,void *arg) { }
@@ -350,7 +350,7 @@ }static inline int -dco_multi_add_new_peer (struct multi_context *m,struct multi_instance *mi) +dco_multi_add_new_peer (const struct multi_context *m,struct multi_instance *mi) {return 0 ; }
@@ -384,7 +384,7 @@ }static inline bool -dco_supports_epoch_data (struct context *c) +dco_supports_epoch_data (const struct context *c) {return false; }
src/openvpn/dco_freebsd.c +2 -2
@@ -778,7 +778,7 @@ }void -dco_event_set (dco_context_t *dco,struct event_set *es,void *arg) +dco_event_set (const dco_context_t *dco,struct event_set *es,void *arg) {struct ifdrv drv;nvlist_t *nvl;
@@ -930,7 +930,7 @@ }bool -dco_supports_epoch_data (struct context *c) +dco_supports_epoch_data (const struct context *c) {return false; }
src/openvpn/dco_internal.h +3 -2
@@ -59,8 +59,9 @@* They are implemented by dco_linux.c */ -int dco_new_peer (dco_context_t *dco,unsigned int peerid,socket_descriptor_t sd,struct sockaddr *localaddr, -struct sockaddr *remoteaddr,const struct in_addr *vpn_ipv4,const struct in6_addr *vpn_ipv6); +int dco_new_peer (dco_context_t *dco,unsigned int peerid,socket_descriptor_t sd, +struct sockaddr *localaddr,struct sockaddr *remoteaddr, +const struct in_addr *vpn_ipv4,const struct in6_addr *vpn_ipv6);int dco_del_peer (dco_context_t *dco,unsigned int peerid);
src/openvpn/dco_linux.c +4 -4
@@ -114,7 +114,7 @@ }static struct nl_msg * -ovpn_dco_nlmsg_create (dco_context_t *dco,uint8_t cmd) +ovpn_dco_nlmsg_create (const dco_context_t *dco,uint8_t cmd) {struct nl_msg *nl_msg =nlmsg_alloc ();if (!nl_msg)
@@ -804,7 +804,7 @@/* libnl < 3.11.0 does not implement nla_get_uint() */ static uint64_t -ovpn_nla_get_uint (struct nlattr *attr) +ovpn_nla_get_uint (const struct nlattr *attr) {if (nla_len (attr) ==sizeof (uint32_t )) {
@@ -916,7 +916,7 @@ }static bool -ovpn_iface_check (dco_context_t *dco,struct nlattr *attrs[]) +ovpn_iface_check (const dco_context_t *dco,struct nlattr *attrs[]) {/* we must know which interface this message is referring to in order to * avoid mixing messages for other instances
@@ -1340,7 +1340,7 @@ }bool -dco_supports_epoch_data (struct context *c) +dco_supports_epoch_data (const struct context *c) {return false; }
src/openvpn/dco_win.c +1 -1
@@ -1100,7 +1100,7 @@ }bool -dco_supports_epoch_data (struct context *c) +dco_supports_epoch_data (const struct context *c) {OVPN_VERSION ver = {0 };return dco_get_version (&ver) && ((ver.Major ==2 && ver.Minor >=8 ) || (ver.Major >2 ));
src/openvpn/dhcp.c +1 -1
@@ -145,7 +145,7 @@ }in_addr_t -dhcp_extract_router_msg (struct buffer *ipbuf) +dhcp_extract_router_msg (const struct buffer *ipbuf) {struct dhcp_full *df = (struct dhcp_full *)BPTR (ipbuf); const int optlen =
src/openvpn/dhcp.h +1 -1
@@ -91,7 +91,7 @@#pragma pack() -in_addr_t dhcp_extract_router_msg (struct buffer *ipbuf); +in_addr_t dhcp_extract_router_msg (const struct buffer *ipbuf);#if defined(_WIN32) || defined(DHCP_UNIT_TEST )#include "tun.h"
src/openvpn/event.h +1 -1
@@ -204,7 +204,7 @@#else /* ifdef _WIN32 */ static inline void -wait_signal (struct event_set *es,void *arg) +wait_signal (const struct event_set *es,const void *arg) { }
src/openvpn/forward.c +6 -6
@@ -231,7 +231,7 @@ }static void -parse_incoming_control_channel_command (struct context *c,struct buffer *buf) +parse_incoming_control_channel_command (struct context *c,const struct buffer *buf) {if (buf_string_match_head_str (buf,"AUTH_FAILED" )) {
@@ -501,7 +501,7 @@ }int -get_server_poll_remaining_time (struct event_timeout *server_poll_timeout) +get_server_poll_remaining_time (const struct event_timeout *server_poll_timeout) {update_time ();int remaining =event_timeout_remaining (server_poll_timeout);
@@ -598,7 +598,7 @@* Buffer reallocation, for use with null encryption. */ static inline void -buffer_turnover (const uint8_t *orig_buf,struct buffer *dest_stub,struct buffer *src_stub, +buffer_turnover (const uint8_t *orig_buf,struct buffer *dest_stub,const struct buffer *src_stub,struct buffer *storage) {if (orig_buf == src_stub->data && src_stub->data != storage->data)
@@ -885,7 +885,7 @@*/ static inline void -socks_postprocess_incoming_link (struct context *c,struct link_socket *sock) +socks_postprocess_incoming_link (struct context *c,const struct link_socket *sock) {if (sock->socks_proxy && sock->info.proto ==PROTO_UDP ) {
@@ -984,7 +984,7 @@ }bool -process_incoming_link_part1 (struct context *c,struct link_socket_info *lsi,bool floated) +process_incoming_link_part1 (struct context *c,const struct link_socket_info *lsi,bool floated) {struct gc_arena gc =gc_new ();bool decrypt_status = false;
@@ -1534,7 +1534,7 @@* @param client Determines whether to the send packet back via tun or link */ void -ipv6_send_icmp_unreachable (struct context *c,struct buffer *buf,bool client) +ipv6_send_icmp_unreachable (struct context *c,const struct buffer *buf,bool client) {#define MAX_ICMPV6LEN 1280struct openvpn_icmp6hdr icmp6out;
src/openvpn/forward.h +2 -2
@@ -112,7 +112,7 @@*/ void encrypt_sign (struct context *c,bool comp_frag); -int get_server_poll_remaining_time (struct event_timeout *server_poll_timeout); +int get_server_poll_remaining_time (const struct event_timeout *server_poll_timeout);/**********************************************************************/ /**
@@ -163,7 +163,7 @@* * @return true if packet is authenticated, false otherwise. */ -bool process_incoming_link_part1 (struct context *c,struct link_socket_info *lsi,bool floated); +bool process_incoming_link_part1 (struct context *c,const struct link_socket_info *lsi,bool floated);/** * Continues processing a packet read from the external network interface.
src/openvpn/init.c +5 -5
@@ -817,7 +817,7 @@ }static void -init_port_share (struct context *c) +init_port_share (const struct context *c) {if (!port_share && (c->options.port_share_host && c->options.port_share_port)) {
@@ -1269,7 +1269,7 @@* prepending to msg() output. */ const char * -format_common_name (struct context *c,struct gc_arena *gc) +format_common_name (const struct context *c,struct gc_arena *gc) {struct buffer out =alloc_buf_gc (256 , gc);if (c->c2.tls_multi)
@@ -1755,7 +1755,7 @@static bool -can_preserve_tun (struct tuntap *tt) +can_preserve_tun (const struct tuntap *tt) {if (tt && tt->backend_driver ==DRIVER_AFUNIX ) {
@@ -1777,7 +1777,7 @@* @param c pointer to the connection context */ static void -add_wfp_block (struct context *c) +add_wfp_block (const struct context *c) {#if defined(_WIN32)/* Fortify 'redirect-gateway block-local' with firewall rules? */
@@ -1803,7 +1803,7 @@* @param adapter_index the VPN adapter index */ static void -del_wfp_block (struct context *c,unsigned long adapter_index) +del_wfp_block (const struct context *c,unsigned long adapter_index) {#if defined(_WIN32)if (c->options.block_outside_dns ||block_local_needed (c->c1.route_list))
src/openvpn/init.h +1 -1
@@ -91,7 +91,7 @@unsigned int pull_permission_mask (const struct context *c); -const char *format_common_name (struct context *c,struct gc_arena *gc); +const char *format_common_name (const struct context *c,struct gc_arena *gc);void reset_coarse_timers (struct context *c);
src/openvpn/interval.h +2 -2
@@ -89,7 +89,7 @@ }static inline void -interval_schedule_wakeup (struct interval *top,interval_t *wakeup) +interval_schedule_wakeup (const struct interval *top,interval_t *wakeup) {const time_t local_now = now;interval_earliest_wakeup (wakeup, top->last_test_true + top->refresh, local_now);
@@ -214,7 +214,7 @@* This function does not check if the timeout is actually valid. */ static inline interval_t -event_timeout_remaining (struct event_timeout *et) +event_timeout_remaining (const struct event_timeout *et) {return (interval_t)((et->last + et->n) - now); }
src/openvpn/list.c +1 -1
@@ -162,7 +162,7 @@ }void -hash_remove_by_value (struct hash *hash,void *value) +hash_remove_by_value (struct hash *hash,const void *value) {struct hash_iterator hi;const struct hash_element *he;
src/openvpn/list.h +1 -1
@@ -73,7 +73,7 @@bool hash_remove_fast (struct hash *hash,struct hash_bucket *bucket,const void *key,uint32_t hv); -void hash_remove_by_value (struct hash *hash,void *value); +void hash_remove_by_value (struct hash *hash,const void *value);struct hash_iterator {
src/openvpn/manage.c +14 -13
@@ -330,7 +330,7 @@ }static void -man_delete_unix_socket (struct management *man) +man_delete_unix_socket (const struct management *man) {#if UNIX_SOCK_SUPPORT if ((man->settings.flags & (MF_UNIX_SOCK |MF_CONNECT_AS_CLIENT )) ==MF_UNIX_SOCK )
@@ -675,7 +675,7 @@* for the log and echo commands. */ static void -man_history (struct management *man,const char *parm,const char *type,struct log_history *log, +man_history (struct management *man,const char *parm,const char *type,const struct log_history *log,bool *realtime,const unsigned int lep_flags) {struct gc_arena gc =gc_new ();
@@ -843,7 +843,7 @@ }static void -man_forget_passwords (struct management *man) +man_forget_passwords (const struct management *man) {ssl_purge_auth (false); (void )ssl_clean_auth_token ();
@@ -851,7 +851,7 @@ }static void -man_net (struct management *man) +man_net (const struct management *man) {if (man->persist.callback.show_net) {
@@ -887,7 +887,7 @@#ifdef ENABLE_PKCS11 static void -man_pkcs11_id_count (struct management *man) +man_pkcs11_id_count (const struct management *man) {msg (M_CLIENT ,">PKCS11ID-COUNT:%d" ,pkcs11_management_id_count ()); }
@@ -1350,7 +1350,7 @@* @return Return whether p has n (or at least n) parameters */ static bool -man_need (struct management *man,const char **p,const int n,unsigned int flags) +man_need (const struct management *man,const char **p,const int n,unsigned int flags) {int i;ASSERT (p[0 ]);
@@ -2365,7 +2365,7 @@* the route/ifconfig/open tun command. See doc/android.txt for details. */ bool -management_android_control (struct management *man,const char *command,const char *msg) +management_android_control (const struct management *man,const char *command,const char *msg) {if (!man) {
@@ -3013,7 +3013,7 @@ }void -management_up_down (struct management *man,const char *updown,const struct env_set *es) +management_up_down (const struct management *man,const char *updown,const struct env_set *es) {if (man->settings.flags &MF_UP_DOWN ) {
@@ -3023,13 +3023,13 @@ }void -management_notify (struct management *man,const char *severity,const char *type,const char *text) +management_notify (const struct management *man,const char *severity,const char *type,const char *text) {msg (M_CLIENT ,">NOTIFY:%s,%s,%s" , severity, type, text); }void -management_notify_generic (struct management *man,const char *str) +management_notify_generic (const struct management *man,const char *str) {msg (M_CLIENT ,"%s" , str); }
@@ -3115,7 +3115,8 @@ }void -management_notify_client_close (struct management *management,struct man_def_auth_context *mdac, +management_notify_client_close (const struct management *management, +struct man_def_auth_context *mdac,const struct env_set *es) {if ((mdac->flags &DAF_INITIAL_AUTH ) && !(mdac->flags &DAF_CONNECTION_CLOSED ))
@@ -3206,7 +3207,7 @@ }void -management_auth_failure (struct management *man,const char *type,const char *reason) +management_auth_failure (const struct management *man,const char *type,const char *reason) {if (reason) {
@@ -3219,7 +3220,7 @@ }void -management_auth_token (struct management *man,const char *token) +management_auth_token (const struct management *man,const char *token) {msg (M_CLIENT ,">PASSWORD:Auth-Token:%s" , token); }
src/openvpn/manage.h +6 -6
@@ -376,12 +376,12 @@void management_event_loop_n_seconds (struct management *man,int sec); -void management_up_down (struct management *man,const char *updown,const struct env_set *es); +void management_up_down (const struct management *man,const char *updown,const struct env_set *es); -void management_notify (struct management *man,const char *severity,const char *type, +void management_notify (const struct management *man,const char *severity,const char *type,const char *text); -void management_notify_generic (struct management *man,const char *str); +void management_notify_generic (const struct management *man,const char *str); void management_notify_client_needing_auth(struct management *management, const unsigned int auth_id,
@@ -391,7 +391,7 @@void management_connection_established (struct management *management,struct man_def_auth_context *mdac,const struct env_set *es); -void management_notify_client_close (struct management *management, +void management_notify_client_close (const struct management *management,struct man_def_auth_context *mdac,const struct env_set *es); void management_learn_addr(struct management *management, struct man_def_auth_context *mdac,
@@ -476,12 +476,12 @@* OpenVPN calls here to indicate a password failure */ -void management_auth_failure (struct management *man,const char *type,const char *reason); +void management_auth_failure (const struct management *man,const char *type,const char *reason);/* * Echo an authentication token to management interface */ -void management_auth_token (struct management *man,const char *token); +void management_auth_token (const struct management *man,const char *token);/* * These functions drive the bytecount in/out counters.
src/openvpn/mbuf.c +1 -1
@@ -160,7 +160,7 @@ }void -mbuf_dereference_instance (struct mbuf_set *ms,struct multi_instance *mi) +mbuf_dereference_instance (struct mbuf_set *ms,const struct multi_instance *mi) {if (ms) {
src/openvpn/mbuf.h +1 -1
@@ -75,7 +75,7 @@bool mbuf_extract_item (struct mbuf_set *ms,struct mbuf_item *item); -void mbuf_dereference_instance (struct mbuf_set *ms,struct multi_instance *mi); +void mbuf_dereference_instance (struct mbuf_set *ms,const struct multi_instance *mi);static inline bool mbuf_defined (const struct mbuf_set *ms)
src/openvpn/mss.c +9 -9
@@ -43,7 +43,7 @@* if yes, hand to mss_fixup_dowork() */ void -mss_fixup_ipv4 (struct buffer *buf,uint16_t maxmss) +mss_fixup_ipv4 (const struct buffer *buf,uint16_t maxmss) {const struct openvpn_iphdr *pip;int hlen;
@@ -80,7 +80,7 @@* (IPv6 header structure is sufficiently different from IPv4...) */ void -mss_fixup_ipv6 (struct buffer *buf,uint16_t maxmss) +mss_fixup_ipv6 (const struct buffer *buf,uint16_t maxmss) {const struct openvpn_ipv6hdr *pip6;struct buffer newbuf;
@@ -136,7 +136,7 @@*/ void -mss_fixup_dowork (struct buffer *buf,uint16_t maxmss) +mss_fixup_dowork (const struct buffer *buf,uint16_t maxmss) {int olen, optlen;uint8_t *opt;
@@ -239,8 +239,8 @@ }static void -frame_calculate_fragment (struct frame *frame,struct key_type *kt,const struct options *options, -struct link_socket_info *lsi) +frame_calculate_fragment (struct frame *frame,const struct key_type *kt,const struct options *options, +const struct link_socket_info *lsi) {#if defined(ENABLE_FRAGMENT )size_t overhead;
@@ -269,8 +269,8 @@ }static void -frame_calculate_mssfix (struct frame *frame,struct key_type *kt,const struct options *options, -struct link_socket_info *lsi) +frame_calculate_mssfix (struct frame *frame,const struct key_type *kt,const struct options *options, +const struct link_socket_info *lsi) {if (options->ce.mssfix_fixed) {
@@ -314,8 +314,8 @@ }void -frame_calculate_dynamic (struct frame *frame,struct key_type *kt,const struct options *options, -struct link_socket_info *lsi) +frame_calculate_dynamic (struct frame *frame,const struct key_type *kt,const struct options *options, +const struct link_socket_info *lsi) {if (options->ce.fragment >0 ) {
src/openvpn/mss.h +5 -5
@@ -29,15 +29,15 @@#include "socket.h" #include "ssl_common.h" -void mss_fixup_ipv4 (struct buffer *buf,uint16_t maxmss); +void mss_fixup_ipv4 (const struct buffer *buf,uint16_t maxmss); -void mss_fixup_ipv6 (struct buffer *buf,uint16_t maxmss); +void mss_fixup_ipv6 (const struct buffer *buf,uint16_t maxmss); -void mss_fixup_dowork (struct buffer *buf,uint16_t maxmss); +void mss_fixup_dowork (const struct buffer *buf,uint16_t maxmss);/** Set the --mssfix option. */ -void frame_calculate_dynamic (struct frame *frame,struct key_type *kt, -const struct options *options,struct link_socket_info *lsi); +void frame_calculate_dynamic (struct frame *frame,const struct key_type *kt, +const struct options *options,const struct link_socket_info *lsi);/** * Checks and adjusts the fragment and mssfix value according to the
src/openvpn/mtcp.c +1 -1
@@ -91,7 +91,7 @@ }bool -multi_tcp_instance_specific_init (struct multi_context *m,struct multi_instance *mi) +multi_tcp_instance_specific_init (const struct multi_context *m,struct multi_instance *mi) {/* buffer for queued TCP socket output packets */ mi->tcp_link_out_deferred =mbuf_init (m->top.options.n_bcast_buf);
src/openvpn/mtcp.h +1 -1
@@ -35,7 +35,7 @@void multi_tcp_dereference_instance (struct multi_io *multi_io,struct multi_instance *mi); -bool multi_tcp_instance_specific_init (struct multi_context *m,struct multi_instance *mi); +bool multi_tcp_instance_specific_init (const struct multi_context *m,struct multi_instance *mi);void multi_tcp_instance_specific_free (struct multi_instance *mi);
src/openvpn/mudp.c +2 -2
@@ -39,7 +39,7 @@static void send_hmac_reset_packet (struct multi_context *m,struct tls_pre_decrypt_state *state, -struct tls_auth_standalone *tas,struct session_id *sid, +const struct tls_auth_standalone *tas,const struct session_id *sid,bool request_resend_wkc) {reset_packet_id_send (&state->tls_wrap_tmp.opt.packet_id.send);
@@ -69,7 +69,7 @@enum first_packet_verdict verdict; -struct tls_auth_standalone *tas = m->top.c2.tls_auth_standalone; +const struct tls_auth_standalone *tas = m->top.c2.tls_auth_standalone; verdict =tls_pre_decrypt_lite (tas, state, &m->top.c2.from, &m->top.c2.buf);
src/openvpn/multi.c +8 -8
@@ -57,7 +57,7 @@#ifdef MULTI_DEBUG_EVENT_LOOP static const char * -id (struct multi_instance *mi) +id (const struct multi_instance *mi) {if (mi) {
@@ -1315,7 +1315,7 @@* same common name. */ static void -multi_delete_dup (struct multi_context *m,struct multi_instance *new_mi) +multi_delete_dup (struct multi_context *m,const struct multi_instance *new_mi) {if (new_mi) {
@@ -2260,7 +2260,7 @@ }static bool -multi_client_setup_dco_initial (struct multi_context *m,struct multi_instance *mi, +multi_client_setup_dco_initial (const struct multi_context *m,struct multi_instance *mi,struct gc_arena *gc) {if (!dco_enabled (&mi->context.options))
@@ -3195,7 +3195,7 @@#if defined(ENABLE_DCO )static void -process_incoming_del_peer (struct multi_context *m,struct multi_instance *mi,dco_context_t *dco) +process_incoming_del_peer (struct multi_context *m,struct multi_instance *mi,const dco_context_t *dco) {const char *reason ="ovpn-dco: unknown reason" ; switch (dco->dco_del_peer_reason)
@@ -4226,7 +4226,7 @@/* Searches for the address and deletes it if it is owned by the multi_instance */ static void -multi_unlearn_addr (struct multi_context *m,struct multi_instance *mi,const struct mroute_addr *addr) +multi_unlearn_addr (struct multi_context *m,const struct multi_instance *mi,const struct mroute_addr *addr) {struct hash_element *he;const uint32_t hv =hash_value (m->vhash, addr);
@@ -4261,7 +4261,7 @@* @param a The new IPv4 address in network byte order */ static void -multi_unlearn_in_addr_t (struct multi_context *m,struct multi_instance *mi,in_addr_t a) +multi_unlearn_in_addr_t (struct multi_context *m,const struct multi_instance *mi,in_addr_t a) {struct mroute_addr addr;CLEAR (addr);
@@ -4279,7 +4279,7 @@* @param a6 The new IPv6 address */ static void -multi_unlearn_in6_addr (struct multi_context *m,struct multi_instance *mi,struct in6_addr a6) +multi_unlearn_in6_addr (struct multi_context *m,const struct multi_instance *mi,struct in6_addr a6) {struct mroute_addr addr;CLEAR (addr);
@@ -4395,7 +4395,7 @@bool multi_check_push_ifconfig_ipv6_extra_route (struct multi_instance *mi, -struct in6_addr *dest) +const struct in6_addr *dest) {struct options *o = &mi->context.options;
src/openvpn/multi.h +2 -2
@@ -520,7 +520,7 @@*/ static inline void -set_prefix (struct multi_instance *mi) +set_prefix (const struct multi_instance *mi) {#ifdef MULTI_DEBUG_EVENT_LOOP if (mi->msg_prefix[0 ])
@@ -694,7 +694,7 @@*/ bool multi_check_push_ifconfig_ipv6_extra_route (struct multi_instance *mi, -struct in6_addr *dest); +const struct in6_addr *dest);/* * Check for signals.
src/openvpn/networking.h +3 -3
@@ -44,7 +44,7 @@*/ #if !defined(ENABLE_IPROUTE )static inline int -net_ctx_init (struct context *c,openvpn_net_ctx_t *ctx) +net_ctx_init (const struct context *c,openvpn_net_ctx_t *ctx) { (void )c; (void )ctx;
@@ -75,7 +75,7 @@* * @return 0 on success, a negative error code otherwise */ -int net_ctx_init (struct context *c,openvpn_net_ctx_t *ctx); +int net_ctx_init (const struct context *c,openvpn_net_ctx_t *ctx);/** * Release resources allocated by the internal garbage collector
@@ -102,7 +102,7 @@* @return 0 on success, negative error code on error */ int net_iface_new (openvpn_net_ctx_t *ctx,const openvpn_net_iface_t *iface,const char *type, -void *arg); +const void *arg);/** * Retrieve the interface type
src/openvpn/networking_iproute2.c +2 -2
@@ -36,7 +36,7 @@#include <netinet/in.h> int -net_ctx_init (struct context *c,openvpn_net_ctx_t *ctx) +net_ctx_init (const struct context *c,openvpn_net_ctx_t *ctx) { ctx->es =NULL ;if (c)
@@ -61,7 +61,7 @@ }int -net_iface_new (openvpn_net_ctx_t *ctx,const char *iface,const char *type,void *arg) +net_iface_new (openvpn_net_ctx_t *ctx,const char *iface,const char *type,const void *arg) {struct argv argv =argv_new ();
src/openvpn/networking_sitnl.c +4 -4
@@ -987,7 +987,7 @@ }static int -sitnl_addr_del (sa_family_t af_family,const char *iface,inet_address_t *addr,int prefixlen) +sitnl_addr_del (sa_family_t af_family,const char *iface,const inet_address_t *addr,int prefixlen) {int ifindex;
@@ -1230,8 +1230,8 @@ }static int -sitnl_route_del (const char *iface,sa_family_t af_family,inet_address_t *dst,int prefixlen, -inet_address_t *gw,uint32_t table,int metric) +sitnl_route_del (const char *iface,sa_family_t af_family,const inet_address_t *dst,int prefixlen, +const inet_address_t *gw,uint32_t table,int metric) {int ifindex =0 ;
@@ -1308,7 +1308,7 @@int -net_iface_new (openvpn_net_ctx_t *ctx,const char *iface,const char *type,void *arg) +net_iface_new (openvpn_net_ctx_t *ctx,const char *iface,const char *type,const void *arg) {struct sitnl_link_req req = {};int ret =-1 ;
src/openvpn/occ.h +1 -1
@@ -156,7 +156,7 @@* via control channel. * @return control channel exit message should be used */ static inline bool -cc_exit_notify_enabled (struct context *c) +cc_exit_notify_enabled (const struct context *c) {/* Check if we have TLS active at all */ if (!c->c2.tls_multi)
src/openvpn/openssl_compat.h +2 -2
@@ -124,7 +124,7 @@/* Mimics the functions but only when the default context without * options is chosen */ static inline const EVP_CIPHER * -EVP_CIPHER_fetch (void *ctx,const char *algorithm,const char *properties) +EVP_CIPHER_fetch (const void *ctx,const char *algorithm,const char *properties) {ASSERT (!ctx);ASSERT (!properties);
@@ -132,7 +132,7 @@ }static inline const EVP_MD * -EVP_MD_fetch (void *ctx,const char *algorithm,const char *properties) +EVP_MD_fetch (const void *ctx,const char *algorithm,const char *properties) {ASSERT (!ctx);ASSERT (!properties);
src/openvpn/options.c +3 -3
@@ -3050,7 +3050,7 @@ }static void -options_postprocess_mutate_le (struct connection_entry *ce,struct local_entry *le,int mode) +options_postprocess_mutate_le (const struct connection_entry *ce,struct local_entry *le,int mode) {/* use the global port if none is specified */ if (!le->port)
@@ -4980,7 +4980,7 @@static bool verify_permission (const char *name,const char *file,int line,const uint64_t type,const uint64_t allowed,uint64_t *found,const msglvl_t msglevel, -struct options *options,bool is_inline) +const struct options *options,bool is_inline) {if (!(type & allowed)) {
@@ -5547,7 +5547,7 @@ }static void -show_compression_warning (struct compress_options *info) +show_compression_warning (const struct compress_options *info) {if (comp_non_stub_enabled (info)) {
src/openvpn/options_parse.c +2 -2
@@ -258,7 +258,7 @@ }static char * -read_inline_file (struct in_src *is,const char *close_tag,int *num_lines,struct gc_arena *gc) +read_inline_file (const struct in_src *is,const char *close_tag,int *num_lines,struct gc_arena *gc) {char line[OPTION_LINE_SIZE ];struct buffer buf =alloc_buf (8 *OPTION_LINE_SIZE );
@@ -302,7 +302,7 @@ }static int -check_inline_file (struct in_src *is,char *p[],struct gc_arena *gc) +check_inline_file (const struct in_src *is,char *p[],struct gc_arena *gc) {int num_inline_lines =0 ;
src/openvpn/otime.c +1 -1
@@ -66,7 +66,7 @@ }void -update_now_usec (struct timeval *tv) +update_now_usec (const struct timeval *tv) {const time_t last = now;update_now (tv->tv_sec);
src/openvpn/otime.h +1 -1
@@ -65,7 +65,7 @@void update_now (const time_t system_time);extern time_t now_usec; -void update_now_usec (struct timeval *tv); +void update_now_usec (const struct timeval *tv);static inline int openvpn_gettimeofday (struct timeval *tv,void *tz)
src/openvpn/proto.h +1 -1
@@ -248,7 +248,7 @@* and offset of IP header (via parameter). */ static inline int -get_tun_ip_ver (int tunnel_type,struct buffer *buf,int *ip_hdr_offset) +get_tun_ip_ver (int tunnel_type,const struct buffer *buf,int *ip_hdr_offset) {int ip_ver =-1 ;
src/openvpn/proxy.c +2 -2
@@ -597,8 +597,8 @@socket_descriptor_t sd,/* already open to proxy */ const char *host, /* openvpn server remote */ const char *port, /* openvpn server port */ - struct event_timeout *server_poll_timeout, struct buffer *lookahead, - struct signal_info *sig_info) + const struct event_timeout *server_poll_timeout, + struct buffer *lookahead, struct signal_info *sig_info) { struct gc_arena gc = gc_new();char buf[512 ];
src/openvpn/proxy.h +1 -1
@@ -89,7 +89,7 @@socket_descriptor_t sd,/* already open to proxy */ const char *host, /* openvpn server remote */ const char *port, /* openvpn server port */ - struct event_timeout *server_poll_timeout, + const struct event_timeout *server_poll_timeout, struct buffer *lookahead, struct signal_info *sig_info);uint8_t *make_base64_string2 (const uint8_t *str,int str_len,struct gc_arena *gc);
src/openvpn/push.c +1 -1
@@ -435,7 +435,7 @@#endif bool -send_auth_pending_messages (struct tls_multi *tls_multi,struct tls_session *session, +send_auth_pending_messages (const struct tls_multi *tls_multi,struct tls_session *session,const char *extra,unsigned int timeout) {struct key_state *ks = &session->key[KS_PRIMARY ];
src/openvpn/push.h +1 -1
@@ -117,7 +117,7 @@* doc/management-notes.txt under client-pending-auth for * more details on message format */ -bool send_auth_pending_messages (struct tls_multi *tls_multi,struct tls_session *session, +bool send_auth_pending_messages (const struct tls_multi *tls_multi,struct tls_session *session,const char *extra,unsigned int timeout);void send_restart (struct context *c,const char *kill_msg);
src/openvpn/push_util.c +1 -1
@@ -222,7 +222,7 @@/* Return true if the client supports push-update */ static bool -support_push_update (struct multi_instance *mi) +support_push_update (const struct multi_instance *mi) {ASSERT (mi->context.c2.tls_multi);const unsigned int iv_proto_peer =extract_iv_proto (mi->context.c2.tls_multi->peer_info);
src/openvpn/reliable.c +3 -3
@@ -92,7 +92,7 @@/* check if a particular packet_id is present in ack */ static inline bool -reliable_ack_packet_id_present (struct reliable_ack *ack,packet_id_type pid) +reliable_ack_packet_id_present (const struct reliable_ack *ack,packet_id_type pid) {for (int i =0 ; i < ack->len; ++i) {
@@ -733,7 +733,7 @@*/ void -reliable_mark_active_incoming (struct reliable *rel,struct buffer *buf,packet_id_type pid, +reliable_mark_active_incoming (struct reliable *rel,const struct buffer *buf,packet_id_type pid,int opcode) {for (int i =0 ; i < rel->size; ++i)
@@ -793,7 +793,7 @@/* delete a buffer previously activated by reliable_mark_active() */ void -reliable_mark_deleted (struct reliable *rel,struct buffer *buf) +reliable_mark_deleted (struct reliable *rel,const struct buffer *buf) {for (int i =0 ; i < rel->size; ++i) {
src/openvpn/reliable.h +4 -4
@@ -173,7 +173,7 @@* @li False, if there are packet IDs to be acknowledged. */ static inline bool -reliable_ack_empty (struct reliable_ack *ack) +reliable_ack_empty (const struct reliable_ack *ack) {return !ack->len; }
@@ -186,7 +186,7 @@* @returns the number of outstanding acks */ static inline int -reliable_ack_outstanding (struct reliable_ack *ack) +reliable_ack_outstanding (const struct reliable_ack *ack) {return ack->len; }
@@ -336,7 +336,7 @@* @param pid The packet's packet ID. * @param opcode The packet's opcode. */ -void reliable_mark_active_incoming (struct reliable *rel,struct buffer *buf,packet_id_type pid, +void reliable_mark_active_incoming (struct reliable *rel,const struct buffer *buf,packet_id_type pid,int opcode);/**
@@ -389,7 +389,7 @@* @param rel The reliable structure associated with the given buffer. * @param buf The buffer of the reliable entry which is to be removed. */ -void reliable_mark_deleted (struct reliable *rel,struct buffer *buf); +void reliable_mark_deleted (struct reliable *rel,const struct buffer *buf);/** @} name Functions for extracting incoming packets */
src/openvpn/route.c +7 -5
@@ -898,8 +898,9 @@ }static bool -add_bypass_routes (struct route_bypass *rb,in_addr_t gateway,const struct tuntap *tt, -unsigned int flags,const struct route_gateway_info *rgi, +add_bypass_routes (const struct route_bypass *rb,in_addr_t gateway, +const struct tuntap *tt,unsigned int flags, +const struct route_gateway_info *rgi,const struct env_set *es,openvpn_net_ctx_t *ctx) {int ret = true;
@@ -916,8 +917,9 @@ }static void -del_bypass_routes (struct route_bypass *rb,in_addr_t gateway,const struct tuntap *tt, -unsigned int flags,const struct route_gateway_info *rgi, +del_bypass_routes (const struct route_bypass *rb,in_addr_t gateway, +const struct tuntap *tt,unsigned int flags, +const struct route_gateway_info *rgi,const struct env_set *es,openvpn_net_ctx_t *ctx) {int i;
@@ -3942,7 +3944,7 @@#else /* if defined(_WIN32) */ static void -get_bypass_addresses (struct route_bypass *rb,const unsigned int flags)/* PLATFORM-SPECIFIC */ +get_bypass_addresses (struct route_bypass *rb,const unsigned int flags) { }
src/openvpn/schedule.c +1 -1
@@ -501,7 +501,7 @@ }int -schedule_debug (struct schedule *s,int *count,struct timeval *least) +schedule_debug (const struct schedule *s,int *count,struct timeval *least) {struct timeval min;struct timeval max;
src/openvpn/socket.c +9 -9
@@ -914,8 +914,8 @@ }void -socket_bind (socket_descriptor_t sd,struct addrinfo *local,int ai_family,const char *prefix, -bool ipv6only) +socket_bind (socket_descriptor_t sd,const struct addrinfo *local,int ai_family, +const char *prefix,bool ipv6only) {struct gc_arena gc =gc_new ();
@@ -1123,8 +1123,8 @@* such as TCP. */ -static void stream_buf_init (struct stream_buf *sb,struct buffer *buf,const unsigned int sockflags, -const int proto); +static void stream_buf_init (struct stream_buf *sb,const struct buffer *buf, +const unsigned int sockflags,const int proto);static void stream_buf_close (struct stream_buf *sb);
@@ -2073,7 +2073,7 @@ }static void -stream_buf_init (struct stream_buf *sb,struct buffer *buf,const unsigned int sockflags, +stream_buf_init (struct stream_buf *sb,const struct buffer *buf,const unsigned int sockflags,const int proto) { sb->buf_init = *buf;
@@ -2462,7 +2462,7 @@#if ENABLE_IP_PKTINFO ssize_t -link_socket_write_udp_posix_sendmsg (struct link_socket *sock,struct buffer *buf, +link_socket_write_udp_posix_sendmsg (struct link_socket *sock,const struct buffer *buf,struct link_socket_actual *to) {struct iovec iov;
@@ -2656,7 +2656,7 @@ }int -socket_send_queue (struct link_socket *sock,struct buffer *buf,const struct link_socket_actual *to) +socket_send_queue (struct link_socket *sock,const struct buffer *buf,const struct link_socket_actual *to) {if (sock->writes.iostate ==IOSTATE_INITIAL ) {
@@ -2756,8 +2756,8 @@return sock->writes.iostate; } -void -read_sockaddr_from_overlapped (struct overlapped_io *io,struct sockaddr *dst,int overlapped_ret) +static void +read_sockaddr_from_overlapped (const struct overlapped_io *io,struct sockaddr *dst,int overlapped_ret) {if (overlapped_ret >=0 && io->addr_defined) {
src/openvpn/socket.h +9 -7
@@ -267,7 +267,7 @@int socket_recv_queue (struct link_socket *sock,int maxsize); -int socket_send_queue (struct link_socket *sock,struct buffer *buf, +int socket_send_queue (struct link_socket *sock,const struct buffer *buf,const struct link_socket_actual *to); typedef struct
@@ -347,8 +347,8 @@struct link_socket *link_socket_new (void ); -void socket_bind (socket_descriptor_t sd,struct addrinfo *local,int af_family,const char *prefix, -bool ipv6only); +void socket_bind (socket_descriptor_t sd,const struct addrinfo *local,int af_family, +const char *prefix,bool ipv6only);int openvpn_connect (socket_descriptor_t sd,const struct sockaddr *remote,int connect_timeout,volatile int *signal_received);
@@ -484,7 +484,7 @@ }static inline bool -link_socket_verify_incoming_addr (struct buffer *buf,const struct link_socket_info *info, +link_socket_verify_incoming_addr (const struct buffer *buf,const struct link_socket_info *info,const struct link_socket_actual *from_addr) {if (buf->len >0 )
@@ -694,12 +694,12 @@#else /* ifdef _WIN32 */ -ssize_t link_socket_write_udp_posix_sendmsg (struct link_socket *sock,struct buffer *buf, +ssize_t link_socket_write_udp_posix_sendmsg (struct link_socket *sock,const struct buffer *buf,struct link_socket_actual *to);static inline ssize_t -link_socket_write_udp_posix (struct link_socket *sock,struct buffer *buf, +link_socket_write_udp_posix (struct link_socket *sock,const struct buffer *buf,struct link_socket_actual *to) {#if ENABLE_IP_PKTINFO
@@ -715,7 +715,7 @@ }static inline ssize_t -link_socket_write_tcp_posix (struct link_socket *sock,struct buffer *buf) +link_socket_write_tcp_posix (struct link_socket *sock,const struct buffer *buf) {return send (sock->sd,BPTR (buf),BLENZ (buf),MSG_NOSIGNAL ); }
@@ -819,6 +819,8 @@ } } +/* cppcheck-suppress constParameterPointer +* sock is modified on Windows via &sock->listen_handle */ static inline void socket_reset_listen_persistent (struct link_socket *sock) {
src/openvpn/socket_util.h +1 -1
@@ -439,7 +439,7 @@static inline bool -addrlist_match_proto (const struct openvpn_sockaddr *a1,struct addrinfo *addr_list,const int proto) +addrlist_match_proto (const struct openvpn_sockaddr *a1,const struct addrinfo *addr_list,const int proto) {return link_socket_proto_connection_oriented (proto) ?addrlist_match (a1, addr_list) :addrlist_port_match (a1, addr_list);
src/openvpn/socks.c +10 -10
@@ -82,7 +82,7 @@static bool socks_proxy_recv_char (uint8_t *c,const char *name,socket_descriptor_t sd, -struct event_timeout *server_poll_timeout, +const struct event_timeout *server_poll_timeout,volatile int *signal_received) {fd_set reads;
@@ -97,8 +97,8 @@ }static bool -socks_username_password_auth (struct socks_proxy_info *p,socket_descriptor_t sd, -struct event_timeout *server_poll_timeout, +socks_username_password_auth (const struct socks_proxy_info *p,socket_descriptor_t sd, +const struct event_timeout *server_poll_timeout,volatile int *signal_received) {char to_send[516 ];
@@ -156,8 +156,8 @@ }static bool -socks_handshake (struct socks_proxy_info *p,socket_descriptor_t sd, -struct event_timeout *server_poll_timeout,volatile int *signal_received) +socks_handshake (const struct socks_proxy_info *p,socket_descriptor_t sd, +const struct event_timeout *server_poll_timeout,volatile int *signal_received) {uint8_t buf[2 ];int len =0 ;
@@ -231,7 +231,7 @@static bool recv_socks_reply (socket_descriptor_t sd,struct openvpn_sockaddr *addr, -struct event_timeout *server_poll_timeout,volatile int *signal_received) +const struct event_timeout *server_poll_timeout,volatile int *signal_received) {uint8_t atyp =0 ;int alen =0 ;
@@ -334,11 +334,11 @@ }void -establish_socks_proxy_passthru (struct socks_proxy_info *p, +establish_socks_proxy_passthru (const struct socks_proxy_info *p,socket_descriptor_t sd,/* already open to proxy */ const char *host,/* openvpn server remote */ const char *servname,/* openvpn server port */ -struct event_timeout *server_poll_timeout, +const struct event_timeout *server_poll_timeout,struct signal_info *sig_info) {char buf[270 ];
@@ -392,10 +392,10 @@ }void -establish_socks_proxy_udpassoc (struct socks_proxy_info *p, +establish_socks_proxy_udpassoc (const struct socks_proxy_info *p,socket_descriptor_t ctrl_sd,/* already open to proxy */ struct openvpn_sockaddr *relay_addr, -struct event_timeout *server_poll_timeout, +const struct event_timeout *server_poll_timeout,struct signal_info *sig_info) {if (!socks_handshake (p, ctrl_sd, server_poll_timeout, &sig_info->signal_received))
src/openvpn/socks.h +4 -4
@@ -47,17 +47,17 @@void socks_proxy_close (struct socks_proxy_info *sp); -void establish_socks_proxy_passthru (struct socks_proxy_info *p, +void establish_socks_proxy_passthru (const struct socks_proxy_info *p,socket_descriptor_t sd,/* already open to proxy */ const char *host,/* openvpn server remote */ const char *servname,/* openvpn server port */ -struct event_timeout *server_poll_timeout, +const struct event_timeout *server_poll_timeout,struct signal_info *sig_info); -void establish_socks_proxy_udpassoc (struct socks_proxy_info *p, +void establish_socks_proxy_udpassoc (const struct socks_proxy_info *p,socket_descriptor_t ctrl_sd,/* already open to proxy */ struct openvpn_sockaddr *relay_addr, -struct event_timeout *server_poll_timeout, +const struct event_timeout *server_poll_timeout,struct signal_info *sig_info);void socks_process_incoming_udp (struct buffer *buf,struct link_socket_actual *from);
src/openvpn/ssl.c +12 -11
@@ -1159,7 +1159,7 @@ }struct tls_multi * -tls_multi_init (struct tls_options *tls_options) +tls_multi_init (const struct tls_options *tls_options) {struct tls_multi *ret;
@@ -1188,7 +1188,7 @@*/ struct tls_auth_standalone * -tls_auth_standalone_init (struct tls_options *tls_options,struct gc_arena *gc) +tls_auth_standalone_init (const struct tls_options *tls_options,struct gc_arena *gc) {struct tls_auth_standalone *tas;
@@ -1336,7 +1336,7 @@static void init_epoch_keys (struct key_state *ks,struct tls_multi *multi,const struct key_type *key_type, -bool server,struct key2 *key2) +bool server,const struct key2 *key2) {/* For now we hardcode this to be 16 for the software based data channel * DCO based implementations/HW implementation might adjust this number
@@ -1375,7 +1375,7 @@static void init_key_contexts (struct key_state *ks,struct tls_multi *multi,const struct key_type *key_type, -bool server,struct key2 *key2,bool dco_enabled) +bool server,const struct key2 *key2,bool dco_enabled) {struct key_ctx_bi *key = &ks->crypto_options.key_ctx_bi;
@@ -1573,8 +1573,9 @@bool tls_session_update_crypto_params_do_work (struct tls_multi *multi,struct tls_session *session, -struct options *options,struct frame *frame, -struct frame *frame_fragment,struct link_socket_info *lsi, +const struct options *options,struct frame *frame, +struct frame *frame_fragment, +const struct link_socket_info *lsi,dco_context_t *dco) {if (session->key[KS_PRIMARY ].crypto_options.key_ctx_bi.initialized)
@@ -1643,7 +1644,7 @@bool tls_session_update_crypto_params (struct tls_multi *multi,struct tls_session *session,struct options *options,struct frame *frame, -struct frame *frame_fragment,struct link_socket_info *lsi, +struct frame *frame_fragment,const struct link_socket_info *lsi,dco_context_t *dco) {if (!check_session_cipher (session, options))
@@ -2495,8 +2496,8 @@ }bool -session_skip_to_pre_start (struct tls_session *session,struct tls_pre_decrypt_state *state, -struct link_socket_actual *from) +session_skip_to_pre_start (struct tls_session *session,const struct tls_pre_decrypt_state *state, +const struct link_socket_actual *from) {struct key_state *ks = &session->key[KS_PRIMARY ]; ks->session_id_remote = state->peer_session_id;
@@ -4011,7 +4012,7 @@ }void -tls_post_encrypt (struct tls_multi *multi,struct buffer *buf) +tls_post_encrypt (struct tls_multi *multi,const struct buffer *buf) {struct key_state *ks = multi->save_ks; multi->save_ks =NULL ;
@@ -4142,7 +4143,7 @@* into a garbage collectable string which is returned. */ const char * -protocol_dump (struct buffer *buffer,unsigned int flags,struct gc_arena *gc) +protocol_dump (const struct buffer *buffer,unsigned int flags,struct gc_arena *gc) {struct buffer out =alloc_buf_gc (256 , gc);struct buffer buf = *buffer;
src/openvpn/ssl.h +8 -7
@@ -166,7 +166,7 @@* * @return A newly allocated and initialized \c tls_multi structure. */ -struct tls_multi *tls_multi_init (struct tls_options *tls_options); +struct tls_multi *tls_multi_init (const struct tls_options *tls_options);/** * Finalize initialization of a \c tls_multi structure.
@@ -187,7 +187,7 @@/* * Initialize a standalone tls-auth verification object. */ -struct tls_auth_standalone *tls_auth_standalone_init (struct tls_options *tls_options, +struct tls_auth_standalone *tls_auth_standalone_init (const struct tls_options *tls_options,struct gc_arena *gc);/**
@@ -371,7 +371,7 @@* @param multi - The TLS state for this packet's destination VPN tunnel. * @param buf - The buffer containing the outgoing packet. */ -void tls_post_encrypt (struct tls_multi *multi,struct buffer *buf); +void tls_post_encrypt (struct tls_multi *multi,const struct buffer *buf);/** @} name Functions for managing security parameter state for data channel packets */
@@ -461,7 +461,8 @@*/ bool tls_session_update_crypto_params (struct tls_multi *multi,struct tls_session *session,struct options *options,struct frame *frame, -struct frame *frame_fragment,struct link_socket_info *lsi, +struct frame *frame_fragment, +const struct link_socket_info *lsi,dco_context_t *dco);/*
@@ -525,7 +526,7 @@#define PD_VERBOSE (1 << 10)#define PD_TLS_CRYPT (1 << 11) -const char *protocol_dump (struct buffer *buffer,unsigned int flags,struct gc_arena *gc); +const char *protocol_dump (const struct buffer *buffer,unsigned int flags,struct gc_arena *gc);/* * debugging code
@@ -573,7 +574,7 @@/* Special method to skip the three way handshake RESET stages. This is * used by the HMAC code when seeing a packet that matches the previous * HMAC based stateless server state */ -bool session_skip_to_pre_start (struct tls_session *session,struct tls_pre_decrypt_state *state, -struct link_socket_actual *from); +bool session_skip_to_pre_start (struct tls_session *session,const struct tls_pre_decrypt_state *state, +const struct link_socket_actual *from);#endif /* ifndef OPENVPN_SSL_H */
src/openvpn/ssl_backend.h +2 -2
@@ -144,7 +144,7 @@* * @return true if the context is initialised, false if not. */ -bool tls_ctx_initialised (struct tls_root_ctx *ctx); +bool tls_ctx_initialised (const struct tls_root_ctx *ctx);/** * Set any library specific options.
@@ -177,7 +177,7 @@* @param ciphers String containing : delimited cipher names, or NULL to use * sane defaults. */ -void tls_ctx_restrict_ciphers_tls13 (struct tls_root_ctx *ctx,const char *ciphers); +void tls_ctx_restrict_ciphers_tls13 (const struct tls_root_ctx *ctx,const char *ciphers);/** * Set the TLS certificate profile. The profile defines which crypto
src/openvpn/ssl_mbedtls.c +2 -2
@@ -161,7 +161,7 @@ }bool -tls_ctx_initialised (struct tls_root_ctx *ctx) +tls_ctx_initialised (const struct tls_root_ctx *ctx) {/* either this should be NULL or should be non-null and then have a * valid TLS ctx inside as well */
@@ -284,7 +284,7 @@ }void -tls_ctx_restrict_ciphers_tls13 (struct tls_root_ctx *ctx,const char *ciphers) +tls_ctx_restrict_ciphers_tls13 (const struct tls_root_ctx *ctx,const char *ciphers) {if (ciphers ==NULL ) {
src/openvpn/ssl_openssl.c +5 -5
@@ -147,7 +147,7 @@ }bool -tls_ctx_initialised (struct tls_root_ctx *ctx) +tls_ctx_initialised (const struct tls_root_ctx *ctx) {/* either this should be NULL or should be non-null and then have a * valid TLS ctx inside as well */
@@ -509,7 +509,7 @@#endif void -tls_ctx_restrict_ciphers_tls13 (struct tls_root_ctx *ctx,const char *ciphers) +tls_ctx_restrict_ciphers_tls13 (const struct tls_root_ctx *ctx,const char *ciphers) {if (ciphers ==NULL ) {
@@ -1165,7 +1165,7 @@ }static void -tls_ctx_load_cert_uri (struct tls_root_ctx *tls_ctx,const char *uri) +tls_ctx_load_cert_uri (const struct tls_root_ctx *tls_ctx,const char *uri) {#if defined(HAVE_OPENSSL_STORE_API )X509 *x =NULL ;
@@ -2078,7 +2078,7 @@ }static void -bio_debug_data (const char *mode,BIO *bio,const uint8_t *buf,int len,const char *desc) +bio_debug_data (const char *mode,const BIO *bio,const uint8_t *buf,int len,const char *desc) {struct gc_arena gc =gc_new ();if (len >0 )
@@ -2092,7 +2092,7 @@ }static void -bio_debug_oc (const char *mode,BIO *bio) +bio_debug_oc (const char *mode,const BIO *bio) {open_biofp (); fprintf(biofp, "BIO %s time=%" PRIi64 " bio=" ptr_format "\n", mode, (int64_t)time(NULL),
src/openvpn/ssl_pkt.c +5 -5
@@ -57,7 +57,7 @@* @return if the swap was successful (buf was large enough) */ static bool -swap_hmac (struct buffer *buf,const struct crypto_options *co,bool incoming) +swap_hmac (const struct buffer *buf,const struct crypto_options *co,bool incoming) {ASSERT (co);
@@ -117,7 +117,7 @@*/ static void tls_wrap_control (struct tls_wrap_ctx *ctx,uint8_t header,struct buffer *buf, -struct session_id *session_id) +const struct session_id *session_id) {if (ctx->mode ==TLS_WRAP_AUTH || ctx->mode ==TLS_WRAP_NONE ) {
@@ -403,9 +403,9 @@struct buffer -tls_reset_standalone (struct tls_wrap_ctx *ctx,struct tls_auth_standalone *tas, -struct session_id *own_sid,struct session_id *remote_sid,uint8_t header, -bool request_resend_wkc) +tls_reset_standalone (struct tls_wrap_ctx *ctx,const struct tls_auth_standalone *tas, +const struct session_id *own_sid,const struct session_id *remote_sid, +uint8_t header,bool request_resend_wkc) {/* Copy buffer here to point at the same data but allow tls_wrap_control * to potentially change buf to point to another buffer without
src/openvpn/ssl_pkt.h +3 -2
@@ -220,8 +220,9 @@* from the tls pre decrypt state. * */ -struct buffer tls_reset_standalone (struct tls_wrap_ctx *ctx,struct tls_auth_standalone *tas, -struct session_id *own_sid,struct session_id *remote_sid, +struct buffer tls_reset_standalone (struct tls_wrap_ctx *ctx,const struct tls_auth_standalone *tas, +const struct session_id *own_sid, +const struct session_id *remote_sid,uint8_t header,bool request_resend_wkc);
src/openvpn/ssl_verify.c +4 -4
@@ -1137,7 +1137,7 @@* cache. */ static bool -tls_authentication_status_use_cache (struct tls_multi *multi) +tls_authentication_status_use_cache (const struct tls_multi *multi) {unsigned int idx =min_uint (multi->tas_cache_num_updates,SIZE (cache_intervals) -1 );time_t latency = cache_intervals[idx];
@@ -1281,7 +1281,7 @@* Check if the script/plugin left a message in the auth failed message * file and relay it to the user */ static void -check_for_client_reason (struct tls_multi *multi,struct auth_deferred_status *status) +check_for_client_reason (struct tls_multi *multi,const struct auth_deferred_status *status) {struct gc_arena gc =gc_new ();const char *msg =key_state_check_auth_failed_message_file (status, &gc);
@@ -1550,7 +1550,7 @@#endif /* ifdef ENABLE_MANAGEMENT */ static bool -set_verify_user_pass_env (struct user_pass *up,struct tls_multi *multi,struct tls_session *session) +set_verify_user_pass_env (const struct user_pass *up,struct tls_multi *multi,struct tls_session *session) {/* Is username defined? */ if ((session->opt->ssl_flags &SSLF_AUTH_USER_PASS_OPTIONAL ) ||strlen (up->username))
@@ -1578,7 +1578,7 @@ }bool -ssl_verify_username_length (struct tls_session *session,const char *username) +ssl_verify_username_length (const struct tls_session *session,const char *username) {if ((session->opt->ssl_flags &SSLF_USERNAME_AS_COMMON_NAME ) &&strlen (username) >TLS_USERNAME_LEN )
src/openvpn/ssl_verify.h +2 -2
@@ -202,7 +202,7 @@* @return true if name is under limit or username-as-common-name * is not active */ -bool ssl_verify_username_length (struct tls_session *session,const char *username); +bool ssl_verify_username_length (const struct tls_session *session,const char *username);/** * Runs the --client-crresponse script if one is defined.
@@ -275,7 +275,7 @@void auth_set_client_reason (struct tls_multi *multi,const char *client_reason);static inline const char * -tls_client_reason (struct tls_multi *multi) +tls_client_reason (const struct tls_multi *multi) {return multi->client_reason; }
src/openvpn/tun.c +3 -3
@@ -978,7 +978,7 @@* -> helper function to simplify code below */ static void -add_route_connected_v6_net (struct tuntap *tt,const struct env_set *es) +add_route_connected_v6_net (const struct tuntap *tt,const struct env_set *es) {struct route_ipv6 r6;
@@ -1020,7 +1020,7 @@*/ in_addr_t -create_arbitrary_remote (struct tuntap *tt) +create_arbitrary_remote (const struct tuntap *tt) {in_addr_t remote;
@@ -1808,7 +1808,7 @@#if defined(TARGET_LINUX ) || defined(TARGET_FREEBSD )static bool -tun_dco_enabled (struct tuntap *tt) +tun_dco_enabled (const struct tuntap *tt) {return tt->backend_driver ==DRIVER_DCO ; }
src/openvpn/tun.h +8 -8
@@ -351,7 +351,7 @@#define IFCONFIG_DEFAULT IFCONFIG_AFTER_TUN_OPENstatic inline int -ifconfig_order (struct tuntap *tt) +ifconfig_order (const struct tuntap *tt) {if (tt->backend_driver ==DRIVER_AFUNIX ) {
@@ -381,7 +381,7 @@#define ROUTE_ORDER_DEFAULT ROUTE_AFTER_TUNstatic inline int -route_order (struct tuntap *tt) +route_order (const struct tuntap *tt) {if (tt->backend_driver ==DRIVER_AFUNIX ) {
@@ -529,13 +529,13 @@ }static inline bool -tuntap_is_dco_win (struct tuntap *tt) +tuntap_is_dco_win (const struct tuntap *tt) {return tt && tt->backend_driver ==DRIVER_DCO ; }static inline bool -tuntap_is_dco_win_timeout (struct tuntap *tt,int status) +tuntap_is_dco_win_timeout (const struct tuntap *tt,int status) {return tuntap_is_dco_win (tt) && (status <0 ) && (openvpn_errno () ==ERROR_NETNAME_DELETED ); }
@@ -555,25 +555,25 @@ }static inline void -tun_standby_init (struct tuntap *tt) +tun_standby_init (const struct tuntap *tt) { }static inline bool -tun_standby (struct tuntap *tt) +tun_standby (const struct tuntap *tt) {return true; }static inline bool -tuntap_is_dco_win (struct tuntap *tt) +tuntap_is_dco_win (const struct tuntap *tt) {return false; }static inline bool -tuntap_is_dco_win_timeout (struct tuntap *tt,int status) +tuntap_is_dco_win_timeout (const struct tuntap *tt,int status) {return false; }
src/openvpn/tun_afunix.c +2 -2
@@ -48,7 +48,7 @@static void -tun_afunix_exec_child (const char *dev_node,struct tuntap *tt,struct env_set *env) +tun_afunix_exec_child (const char *dev_node,struct tuntap *tt,const struct env_set *env) {const char *msgprefix ="ERROR: failure executing process for tun:" ;struct argv argv =argv_new ();
@@ -73,7 +73,7 @@ }void -open_tun_afunix (struct options *o,int mtu,struct tuntap *tt,struct env_set *orig_env) +open_tun_afunix (const struct options *o,int mtu,struct tuntap *tt,const struct env_set *orig_env) {struct gc_arena gc =gc_new ();
src/openvpn/tun_afunix.h +1 -1
@@ -31,7 +31,7 @@* the user provided taking care of implementing the actual tun * device. */ -void open_tun_afunix (struct options *o,int mtu,struct tuntap *tt,struct env_set *env); +void open_tun_afunix (const struct options *o,int mtu,struct tuntap *tt,const struct env_set *env);/**
src/openvpn/vlan.c +1 -1
@@ -288,7 +288,7 @@ }void -vlan_process_outgoing_tun (struct multi_context *m,struct multi_instance *mi) +vlan_process_outgoing_tun (const struct multi_context *m,struct multi_instance *mi) {if (!m->top.options.vlan_tagging) {
src/openvpn/vlan.h +1 -1
@@ -35,6 +35,6 @@bool vlan_is_tagged (const struct buffer *buf); -void vlan_process_outgoing_tun (struct multi_context *m,struct multi_instance *mi); +void vlan_process_outgoing_tun (const struct multi_context *m,struct multi_instance *mi);#endif /* VLAN_H */
src/openvpn/win32.h +1 -1
@@ -226,7 +226,7 @@void overlapped_io_close (struct overlapped_io *o);static inline bool -overlapped_io_active (struct overlapped_io *o) +overlapped_io_active (const struct overlapped_io *o) {return o->iostate ==IOSTATE_QUEUED || o->iostate ==IOSTATE_IMMEDIATE_RETURN ; }
src/openvpnmsica/openvpnmsica.c +1 -1
@@ -77,7 +77,7 @@* @return ERROR_SUCCESS on success; An error code otherwise */ static UINT -setup_sequence(_In_ MSIHANDLE hInstall, _In_z_ LPCWSTR szProperty, _In_ struct msica_arg_seq *seq) +setup_sequence(_In_ MSIHANDLE hInstall, _In_z_ LPCWSTR szProperty, _In_ const struct msica_arg_seq *seq) {UINT uiResult;LPWSTR szSequence =msica_arg_seq_join (seq);
src/openvpnserv/interactive.c +2 -2
@@ -521,7 +521,7 @@static SOCKADDR_INET -sockaddr_inet (short family,inet_address_t *addr) +sockaddr_inet (short family,const inet_address_t *addr) {SOCKADDR_INET sa_inet;ZeroMemory (&sa_inet,sizeof (sa_inet));
@@ -3722,7 +3722,7 @@static DWORD UpdateWaitHandles (LPHANDLE *handles_ptr,LPDWORD count,HANDLE io_event,HANDLE exit_event, -list_item_t *threads) +const list_item_t *threads) {static DWORD size =10 ;static LPHANDLE handles =NULL ;
tests/unit_tests/openvpn/mock_management.c +1 -1
@@ -36,7 +36,7 @@struct management *management;/* GLOBAL */ void -management_auth_failure (struct management *man,const char *type,const char *reason) +management_auth_failure (const struct management *man,const char *type,const char *reason) {ASSERT (false); }
tests/unit_tests/openvpn/test_misc.c +1 -1
@@ -146,7 +146,7 @@ }static struct hash_element * -hash_lookup_by_value (struct hash *hash,void *value) +hash_lookup_by_value (struct hash *hash,const void *value) {struct hash_iterator hi;struct hash_element *he;
tests/unit_tests/openvpn/test_user_pass.c +1 -1
@@ -59,7 +59,7 @@return mock (); }void -management_auth_failure (struct management *man,const char *type,const char *reason) +management_auth_failure (const struct management *man,const char *type,const char *reason) {assert_true (0 ); }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1663?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I56248cf6d199c2da770774b8fd1e5daf2b116f58
Gerrit-Change-Number: 1663
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1663?usp=email
to look at the new patch set (#3).
Change subject: Remove instances of constParameterPointer cppcheck warnings
......................................................................
Remove instances of constParameterPointer cppcheck warnings
This requires a few suppressions since cppcheck
doesn't quite understand the different code-paths
implemented by preprocessor defines.
---
M dev-tools/cppcheck-suppression
M sample/sample-plugins/client-connect/sample-client-connect.c
M sample/sample-plugins/defer/multi-auth.c
M sample/sample-plugins/keying-material-exporter-demo/keyingmaterialexporter.c M src/openvpn/buffer.c
M src/openvpn/buffer.h
M src/openvpn/clinat.c
M src/openvpn/clinat.h
M src/openvpn/comp.c
M src/openvpn/comp.h
M src/openvpn/crypto.c
M src/openvpn/crypto.h
M src/openvpn/dco.c
M src/openvpn/dco.h
M src/openvpn/dco_freebsd.c
M src/openvpn/dco_internal.h
M src/openvpn/dco_linux.c
M src/openvpn/dco_win.c
M src/openvpn/dhcp.c
M src/openvpn/dhcp.h
M src/openvpn/event.h
M src/openvpn/forward.c
M src/openvpn/forward.h
M src/openvpn/init.c
M src/openvpn/init.h
M src/openvpn/interval.h
M src/openvpn/list.c
M src/openvpn/list.h
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/mbuf.c
M src/openvpn/mbuf.h
M src/openvpn/mss.c
M src/openvpn/mss.h
M src/openvpn/mtcp.c
M src/openvpn/mtcp.h
M src/openvpn/mudp.c
M src/openvpn/multi.c
M src/openvpn/multi.h
M src/openvpn/networking.h
M src/openvpn/networking_iproute2.c
M src/openvpn/networking_sitnl.c
M src/openvpn/occ.h
M src/openvpn/openssl_compat.h
M src/openvpn/options.c
M src/openvpn/options_parse.c
M src/openvpn/otime.c
M src/openvpn/otime.h
M src/openvpn/proto.h
M src/openvpn/proxy.c
M src/openvpn/proxy.h
M src/openvpn/ps.c
M src/openvpn/ps.h
M src/openvpn/push.c
M src/openvpn/push.h
M src/openvpn/push_util.c
M src/openvpn/reliable.c
M src/openvpn/reliable.h
M src/openvpn/route.c
M src/openvpn/schedule.c
M src/openvpn/socket.c
M src/openvpn/socket.h
M src/openvpn/socket_util.h
M src/openvpn/socks.c
M src/openvpn/socks.h
M src/openvpn/ssl.c
M src/openvpn/ssl.h
M src/openvpn/ssl_backend.h
M src/openvpn/ssl_mbedtls.c
M src/openvpn/ssl_openssl.c
M src/openvpn/ssl_pkt.c
M src/openvpn/ssl_pkt.h
M src/openvpn/ssl_verify.c
M src/openvpn/ssl_verify.h
M src/openvpn/status.c
M src/openvpn/status.h
M src/openvpn/tun.c
M src/openvpn/tun.h
M src/openvpn/tun_afunix.c
M src/openvpn/tun_afunix.h
M src/openvpn/vlan.c
M src/openvpn/vlan.h
M src/openvpn/win32.h
M src/openvpnmsica/openvpnmsica.c
M src/openvpnserv/interactive.c
M tests/unit_tests/openvpn/mock_management.c
M tests/unit_tests/openvpn/test_misc.c
M tests/unit_tests/openvpn/test_user_pass.c
88 files changed, 322 insertions(+), 281 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/63/1663/3
dev-tools/cppcheck-suppression +32 -1
@@ -2,7 +2,6 @@ # occurences right now. They still should be fixed at some point constParameter constParameterCallback -constParameterPointer invalidPrintfArgType_sint invalidPrintfArgType_uint usleepCalled
@@ -33,6 +32,38 @@ badBitmaskCheck:tests/unit_tests/openvpn/test_pkt.c # IGN: we store integers in pointers CastAddressToIntegerAtReturn:src/openvpn/multi.c +constParameterPointer:/usr/include/* +# IGN: test files provide mocks/stubs that match prototypes from headers exactly +constParameterPointer:tests/unit_tests/openvpn/mock_* +constParameterPointer:tests/unit_tests/openvpn/test_* +constParameterPointer:tests/unit_tests/openvpnserv/test_* +# FP: different crypto implementations but same API +constParameterPointer:src/openvpn/crypto_mbedtls_legacy.c:85 +constParameterPointer:src/openvpn/crypto_openssl.c:172 +constParameterPointer:src/openvpn/crypto_openssl.c:1456 +constParameterPointer:src/openvpn/cryptoapi.c:58 +constParameterPointer:src/openvpn/ssl_mbedtls.c +constParameterPointer:src/openvpn/ssl_openssl.c +constParameterPointer:src/openvpn/ssl_verify_mbedtls.c +# IGN: too many different implementations, not worth it +constParameterPointer:src/openvpn/dco* +# FP: parameters are modified on some platform only +constParameterPointer:src/openvpn/dns.c:859 +constParameterPointer:src/openvpn/error.c:223 +constParameterPointer:src/openvpn/manage.c:344 +constParameterPointer:src/openvpn/manage.c:3332 +constParameterPointer:src/openvpn/misc.c:792 +constParameterPointer:src/openvpn/misc.c:812 +constParameterPointer:src/openvpn/options.c:3205 +constParameterPointer:src/openvpn/route.c:3947 +constParameterPointer:src/openvpn/socket.c:2244 +constParameterPointer:src/openvpn/socket.h:726 +constParameterPointer:src/openvpn/socket.h:825 +constParameterPointer:src/openvpn/tun.c:560 +constParameterPointer:src/openvpn/tun.c:2188 +constParameterPointer:src/openvpn/tun_afunix.c +# FP: local is modified via cast inside function +constParameterPointer:src/openvpn/dco.c:560 # IGN: event code uses a pointer to store integers intToPointerCast:src/openvpn/forward.c intToPointerCast:src/openvpn/multi_io.c
sample/sample-plugins/client-connect/sample-client-connect.c +2 -2
@@ -344,7 +344,7 @@ }int -openvpn_plugin_client_connect (struct plugin_context *context,const char **argv,const char **envp) +openvpn_plugin_client_connect (const struct plugin_context *context,const char **argv,const char **envp) {/* log environment variables handed to us by OpenVPN, but * only if "setenv verb" is 3 or higher (arbitrary number)
@@ -465,7 +465,7 @@int openvpn_plugin_client_connect_defer_v2 (struct plugin_context *context, -struct plugin_per_client_context *pcc, +const struct plugin_per_client_context *pcc,struct openvpn_plugin_string_list **return_list) {time_t time_left = pcc->sleep_until -time (NULL );
sample/sample-plugins/defer/multi-auth.c +2 -2
@@ -255,7 +255,7 @@ }static bool -do_auth_user_pass (struct plugin_context *context,const char *username,const char *password) +do_auth_user_pass (const struct plugin_context *context,const char *username,const char *password) {plog (context,PLOG_NOTE ,"expect_user=%s, received_user=%s, expect_passw=%s, received_passw=%s" ,np (context->test_valid_user),np (username),np (context->test_valid_pass),np (password));
@@ -279,7 +279,7 @@static int -auth_user_pass_verify (struct plugin_context *context,struct plugin_per_client_context *pcc, +auth_user_pass_verify (const struct plugin_context *context,struct plugin_per_client_context *pcc,const char *argv[],const char *envp[]) {/* get username/password from envp string array */
sample/sample-plugins/keying-material-exporter-demo/keyingmaterialexporter.c +3 -3
@@ -186,7 +186,7 @@ }static void -file_store (char *file,char *content) +file_store (const char *file,const char *content) {FILE *f;if (!(f =fopen (file,"w+" )))
@@ -202,7 +202,7 @@ server_store(struct openvpn_plugin_args_func_in const *args) {struct plugin *plugin = (struct plugin *)args->handle; -struct session *sess = (struct session *)args->per_client_context; +const struct session *sess = (struct session *)args->per_client_context;char file[MAXPATH ];snprintf (file,sizeof (file) -1 ,"/tmp/openvpn_sso_%s" , sess->key);
@@ -214,7 +214,7 @@ client_store(struct openvpn_plugin_args_func_in const *args) {struct plugin *plugin = (struct plugin *)args->handle; -struct session *sess = (struct session *)args->per_client_context; +const struct session *sess = (struct session *)args->per_client_context;char *file ="/tmp/openvpn_sso_user" ;ovpn_note ("app session file: %s" , file);
src/openvpn/buffer.c +2 -2
@@ -290,7 +290,7 @@* truncated by buf_printf */ void -buf_catrunc (struct buffer *buf,const char *str) +buf_catrunc (const struct buffer *buf,const char *str) {if (buf_forward_capacity (buf) <=1 ) {
@@ -1091,7 +1091,7 @@ }bool -string_check_buf (struct buffer *buf,const unsigned int inclusive,const unsigned int exclusive) +string_check_buf (const struct buffer *buf,const unsigned int inclusive,const unsigned int exclusive) {ASSERT (buf);
src/openvpn/buffer.h +4 -4
@@ -487,7 +487,7 @@* write a string to the end of a buffer that was * truncated by buf_printf */ -void buf_catrunc (struct buffer *buf,const char *str); +void buf_catrunc (const struct buffer *buf,const char *str);/* * Parse a string based on a given delimiter char
@@ -774,7 +774,7 @@ }static inline int -buf_peek_u8 (struct buffer *buf) +buf_peek_u8 (const struct buffer *buf) {int ret;if (BLEN (buf) <1 )
@@ -923,7 +923,7 @@* @param exclusive Character classes that are not allowed even if they are also in inclusive. * @return True if the string consists only of allowed characters, false otherwise. */ -bool string_check_buf (struct buffer *buf,const unsigned int inclusive, +bool string_check_buf (const struct buffer *buf,const unsigned int inclusive,const unsigned int exclusive);/**
@@ -1102,7 +1102,7 @@ }static inline void -check_malloc_return (void *p) +check_malloc_return (const void *p) {if (!p) {
src/openvpn/clinat.c +2 -2
@@ -159,7 +159,7 @@#endif static void -print_pkt (struct openvpn_iphdr *iph,const char *prefix,const int direction,const msglvl_t msglevel) +print_pkt (const struct openvpn_iphdr *iph,const char *prefix,const int direction,const msglvl_t msglevel) {struct gc_arena gc =gc_new ();
@@ -181,7 +181,7 @@ }void -client_nat_transform (const struct client_nat_option_list *list,struct buffer *ipbuf, +client_nat_transform (const struct client_nat_option_list *list,const struct buffer *ipbuf,const int direction) {struct ip_tcp_udp_hdr *h = (struct ip_tcp_udp_hdr *)BPTR (ipbuf);
src/openvpn/clinat.h +1 -1
@@ -60,7 +60,7 @@ const char *network, const char *netmask, const char *foreign_network, msglvl_t msglevel); -void client_nat_transform (const struct client_nat_option_list *list,struct buffer *ipbuf, +void client_nat_transform (const struct client_nat_option_list *list,const struct buffer *ipbuf,const int direction);#endif /* if !defined(CLINAT_H) */
src/openvpn/comp.c +1 -1
@@ -159,7 +159,7 @@#endif /* USE_COMP */ bool -check_compression_settings_valid (struct compress_options *info,msglvl_t msglevel) +check_compression_settings_valid (const struct compress_options *info,msglvl_t msglevel) {/* * We also allow comp-stub-v2 here as it technically allows escaping of
src/openvpn/comp.h +1 -1
@@ -91,7 +91,7 @@* flags of allow-compression and also the whether algorithms are compiled * in */ -bool check_compression_settings_valid (struct compress_options *info,msglvl_t msglevel); +bool check_compression_settings_valid (const struct compress_options *info,msglvl_t msglevel);#ifdef USE_COMP #include "buffer.h"
src/openvpn/crypto.c +3 -3
@@ -1105,7 +1105,7 @@ }static bool -key_is_zero (struct key *key,const struct key_type *kt) +key_is_zero (const struct key *key,const struct key_type *kt) {size_t cipher_length =cipher_kt_key_size (kt->cipher);for (size_t i =0 ; i < cipher_length; ++i)
@@ -1123,7 +1123,7 @@* Make sure that cipher key is a valid key for current key_type. */ bool -check_key (struct key *key,const struct key_type *kt) +check_key (const struct key *key,const struct key_type *kt) {if (cipher_defined (kt->cipher)) {
@@ -1196,7 +1196,7 @@ }void -test_crypto (struct crypto_options *co,struct frame *frame) +test_crypto (struct crypto_options *co,const struct frame *frame) {int i, j;struct gc_arena gc =gc_new ();
src/openvpn/crypto.h +2 -2
@@ -414,7 +414,7 @@*/ int write_key_file (const int nkeys,const char *filename); -bool check_key (struct key *key,const struct key_type *kt); +bool check_key (const struct key *key,const struct key_type *kt);/** * Initialize a key_type structure with.
@@ -609,7 +609,7 @@/** Print a cipher list entry */ void print_cipher (const char *cipher); -void test_crypto (struct crypto_options *co,struct frame *f); +void test_crypto (struct crypto_options *co,const struct frame *f);/* key direction functions */
src/openvpn/dco.c +5 -5
@@ -556,7 +556,7 @@ }static bool -dco_multi_get_localaddr (struct multi_context *m,struct multi_instance *mi, +dco_multi_get_localaddr (const struct multi_context *m,const struct multi_instance *mi,struct sockaddr_storage *local) {#if ENABLE_IP_PKTINFO
@@ -568,7 +568,7 @@return false; } -struct link_socket_actual *actual = &c->c2.link_socket_infos[0 ]->lsa->actual; +const struct link_socket_actual *actual = &c->c2.link_socket_infos[0 ]->lsa->actual;switch (actual->dest.addr.sa.sa_family) {
@@ -606,7 +606,7 @@ }int -dco_multi_add_new_peer (struct multi_context *m,struct multi_instance *mi) +dco_multi_add_new_peer (const struct multi_context *m,struct multi_instance *mi) {const struct context *c = &mi->context;
@@ -660,7 +660,7 @@ }void -dco_install_iroute (struct multi_context *m,struct multi_instance *mi,struct mroute_addr *addr) +dco_install_iroute (struct multi_context *m,struct multi_instance *mi,const struct mroute_addr *addr) {#if defined(TARGET_LINUX ) || defined(TARGET_FREEBSD ) || defined(_WIN32)if (!dco_enabled (&m->top.options))
@@ -779,7 +779,7 @@/* Checked if we added a host route as the assigned client IP address was * outside the --ifconfig-ipv6 tun interface config */ #if !defined(_WIN32) -struct in6_addr *dest = &mi->context.c2.push_ifconfig_ipv6_local; +const struct in6_addr *dest = &mi->context.c2.push_ifconfig_ipv6_local;if (multi_check_push_ifconfig_ipv6_extra_route (mi, dest)) {/* On windows we do not install these routes, so we also do not need to delete them */
src/openvpn/dco.h +5 -5
@@ -204,7 +204,7 @@* @param mi the client instance * @return 0 on success or a negative error code otherwise */ -int dco_multi_add_new_peer (struct multi_context *m,struct multi_instance *mi); +int dco_multi_add_new_peer (const struct multi_context *m,struct multi_instance *mi);/** * Install an iroute in DCO, which means adding a route to the system routing
@@ -215,7 +215,7 @@* @param addr the route to add */ void dco_install_iroute (struct multi_context *m,struct multi_instance *mi, -struct mroute_addr *addr); +const struct mroute_addr *addr);/** * Remove all routes added through the specified client
@@ -253,7 +253,7 @@* a 64 bit packet counter and AEAD tag at the end. */ bool -dco_supports_epoch_data (struct context *c); +dco_supports_epoch_data (const struct context *c);#else /* if defined(ENABLE_DCO) */ typedef void *dco_context_t ;
@@ -350,7 +350,7 @@ }static inline int -dco_multi_add_new_peer (struct multi_context *m,struct multi_instance *mi) +dco_multi_add_new_peer (const struct multi_context *m,struct multi_instance *mi) {return 0 ; }
@@ -384,7 +384,7 @@ }static inline bool -dco_supports_epoch_data (struct context *c) +dco_supports_epoch_data (const struct context *c) {return false; }
src/openvpn/dco_freebsd.c +1 -1
@@ -930,7 +930,7 @@ }bool -dco_supports_epoch_data (struct context *c) +dco_supports_epoch_data (const struct context *c) {return false; }
src/openvpn/dco_internal.h +3 -2
@@ -59,8 +59,9 @@* They are implemented by dco_linux.c */ -int dco_new_peer (dco_context_t *dco,unsigned int peerid,socket_descriptor_t sd,struct sockaddr *localaddr, -struct sockaddr *remoteaddr,const struct in_addr *vpn_ipv4,const struct in6_addr *vpn_ipv6); +int dco_new_peer (dco_context_t *dco,unsigned int peerid,socket_descriptor_t sd, +struct sockaddr *localaddr,struct sockaddr *remoteaddr, +const struct in_addr *vpn_ipv4,const struct in6_addr *vpn_ipv6);int dco_del_peer (dco_context_t *dco,unsigned int peerid);
src/openvpn/dco_linux.c +4 -4
@@ -114,7 +114,7 @@ }static struct nl_msg * -ovpn_dco_nlmsg_create (dco_context_t *dco,uint8_t cmd) +ovpn_dco_nlmsg_create (const dco_context_t *dco,uint8_t cmd) {struct nl_msg *nl_msg =nlmsg_alloc ();if (!nl_msg)
@@ -804,7 +804,7 @@/* libnl < 3.11.0 does not implement nla_get_uint() */ static uint64_t -ovpn_nla_get_uint (struct nlattr *attr) +ovpn_nla_get_uint (const struct nlattr *attr) {if (nla_len (attr) ==sizeof (uint32_t )) {
@@ -916,7 +916,7 @@ }static bool -ovpn_iface_check (dco_context_t *dco,struct nlattr *attrs[]) +ovpn_iface_check (const dco_context_t *dco,struct nlattr *attrs[]) {/* we must know which interface this message is referring to in order to * avoid mixing messages for other instances
@@ -1340,7 +1340,7 @@ }bool -dco_supports_epoch_data (struct context *c) +dco_supports_epoch_data (const struct context *c) {return false; }
src/openvpn/dco_win.c +1 -1
@@ -1100,7 +1100,7 @@ }bool -dco_supports_epoch_data (struct context *c) +dco_supports_epoch_data (const struct context *c) {OVPN_VERSION ver = {0 };return dco_get_version (&ver) && ((ver.Major ==2 && ver.Minor >=8 ) || (ver.Major >2 ));
src/openvpn/dhcp.c +1 -1
@@ -145,7 +145,7 @@ }in_addr_t -dhcp_extract_router_msg (struct buffer *ipbuf) +dhcp_extract_router_msg (const struct buffer *ipbuf) {struct dhcp_full *df = (struct dhcp_full *)BPTR (ipbuf); const int optlen =
src/openvpn/dhcp.h +1 -1
@@ -91,7 +91,7 @@#pragma pack() -in_addr_t dhcp_extract_router_msg (struct buffer *ipbuf); +in_addr_t dhcp_extract_router_msg (const struct buffer *ipbuf);#if defined(_WIN32) || defined(DHCP_UNIT_TEST )#include "tun.h"
src/openvpn/event.h +1 -1
@@ -204,7 +204,7 @@#else /* ifdef _WIN32 */ static inline void -wait_signal (struct event_set *es,void *arg) +wait_signal (const struct event_set *es,const void *arg) { }
src/openvpn/forward.c +6 -6
@@ -231,7 +231,7 @@ }static void -parse_incoming_control_channel_command (struct context *c,struct buffer *buf) +parse_incoming_control_channel_command (struct context *c,const struct buffer *buf) {if (buf_string_match_head_str (buf,"AUTH_FAILED" )) {
@@ -501,7 +501,7 @@ }int -get_server_poll_remaining_time (struct event_timeout *server_poll_timeout) +get_server_poll_remaining_time (const struct event_timeout *server_poll_timeout) {update_time ();int remaining =event_timeout_remaining (server_poll_timeout);
@@ -598,7 +598,7 @@* Buffer reallocation, for use with null encryption. */ static inline void -buffer_turnover (const uint8_t *orig_buf,struct buffer *dest_stub,struct buffer *src_stub, +buffer_turnover (const uint8_t *orig_buf,struct buffer *dest_stub,const struct buffer *src_stub,struct buffer *storage) {if (orig_buf == src_stub->data && src_stub->data != storage->data)
@@ -885,7 +885,7 @@*/ static inline void -socks_postprocess_incoming_link (struct context *c,struct link_socket *sock) +socks_postprocess_incoming_link (struct context *c,const struct link_socket *sock) {if (sock->socks_proxy && sock->info.proto ==PROTO_UDP ) {
@@ -984,7 +984,7 @@ }bool -process_incoming_link_part1 (struct context *c,struct link_socket_info *lsi,bool floated) +process_incoming_link_part1 (struct context *c,const struct link_socket_info *lsi,bool floated) {struct gc_arena gc =gc_new ();bool decrypt_status = false;
@@ -1534,7 +1534,7 @@* @param client Determines whether to the send packet back via tun or link */ void -ipv6_send_icmp_unreachable (struct context *c,struct buffer *buf,bool client) +ipv6_send_icmp_unreachable (struct context *c,const struct buffer *buf,bool client) {#define MAX_ICMPV6LEN 1280struct openvpn_icmp6hdr icmp6out;
src/openvpn/forward.h +2 -2
@@ -112,7 +112,7 @@*/ void encrypt_sign (struct context *c,bool comp_frag); -int get_server_poll_remaining_time (struct event_timeout *server_poll_timeout); +int get_server_poll_remaining_time (const struct event_timeout *server_poll_timeout);/**********************************************************************/ /**
@@ -163,7 +163,7 @@* * @return true if packet is authenticated, false otherwise. */ -bool process_incoming_link_part1 (struct context *c,struct link_socket_info *lsi,bool floated); +bool process_incoming_link_part1 (struct context *c,const struct link_socket_info *lsi,bool floated);/** * Continues processing a packet read from the external network interface.
src/openvpn/init.c +5 -5
@@ -817,7 +817,7 @@ }static void -init_port_share (struct context *c) +init_port_share (const struct context *c) {if (!port_share && (c->options.port_share_host && c->options.port_share_port)) {
@@ -1269,7 +1269,7 @@* prepending to msg() output. */ const char * -format_common_name (struct context *c,struct gc_arena *gc) +format_common_name (const struct context *c,struct gc_arena *gc) {struct buffer out =alloc_buf_gc (256 , gc);if (c->c2.tls_multi)
@@ -1755,7 +1755,7 @@static bool -can_preserve_tun (struct tuntap *tt) +can_preserve_tun (const struct tuntap *tt) {if (tt && tt->backend_driver ==DRIVER_AFUNIX ) {
@@ -1777,7 +1777,7 @@* @param c pointer to the connection context */ static void -add_wfp_block (struct context *c) +add_wfp_block (const struct context *c) {#if defined(_WIN32)/* Fortify 'redirect-gateway block-local' with firewall rules? */
@@ -1803,7 +1803,7 @@* @param adapter_index the VPN adapter index */ static void -del_wfp_block (struct context *c,unsigned long adapter_index) +del_wfp_block (const struct context *c,unsigned long adapter_index) {#if defined(_WIN32)if (c->options.block_outside_dns ||block_local_needed (c->c1.route_list))
src/openvpn/init.h +1 -1
@@ -91,7 +91,7 @@unsigned int pull_permission_mask (const struct context *c); -const char *format_common_name (struct context *c,struct gc_arena *gc); +const char *format_common_name (const struct context *c,struct gc_arena *gc);void reset_coarse_timers (struct context *c);
src/openvpn/interval.h +2 -2
@@ -89,7 +89,7 @@ }static inline void -interval_schedule_wakeup (struct interval *top,interval_t *wakeup) +interval_schedule_wakeup (const struct interval *top,interval_t *wakeup) {const time_t local_now = now;interval_earliest_wakeup (wakeup, top->last_test_true + top->refresh, local_now);
@@ -214,7 +214,7 @@* This function does not check if the timeout is actually valid. */ static inline interval_t -event_timeout_remaining (struct event_timeout *et) +event_timeout_remaining (const struct event_timeout *et) {return (interval_t)((et->last + et->n) - now); }
src/openvpn/list.c +1 -1
@@ -162,7 +162,7 @@ }void -hash_remove_by_value (struct hash *hash,void *value) +hash_remove_by_value (struct hash *hash,const void *value) {struct hash_iterator hi;const struct hash_element *he;
src/openvpn/list.h +1 -1
@@ -73,7 +73,7 @@bool hash_remove_fast (struct hash *hash,struct hash_bucket *bucket,const void *key,uint32_t hv); -void hash_remove_by_value (struct hash *hash,void *value); +void hash_remove_by_value (struct hash *hash,const void *value);struct hash_iterator {
src/openvpn/manage.c +14 -13
@@ -330,7 +330,7 @@ }static void -man_delete_unix_socket (struct management *man) +man_delete_unix_socket (const struct management *man) {#if UNIX_SOCK_SUPPORT if ((man->settings.flags & (MF_UNIX_SOCK |MF_CONNECT_AS_CLIENT )) ==MF_UNIX_SOCK )
@@ -675,7 +675,7 @@* for the log and echo commands. */ static void -man_history (struct management *man,const char *parm,const char *type,struct log_history *log, +man_history (struct management *man,const char *parm,const char *type,const struct log_history *log,bool *realtime,const unsigned int lep_flags) {struct gc_arena gc =gc_new ();
@@ -843,7 +843,7 @@ }static void -man_forget_passwords (struct management *man) +man_forget_passwords (const struct management *man) {ssl_purge_auth (false); (void )ssl_clean_auth_token ();
@@ -851,7 +851,7 @@ }static void -man_net (struct management *man) +man_net (const struct management *man) {if (man->persist.callback.show_net) {
@@ -887,7 +887,7 @@#ifdef ENABLE_PKCS11 static void -man_pkcs11_id_count (struct management *man) +man_pkcs11_id_count (const struct management *man) {msg (M_CLIENT ,">PKCS11ID-COUNT:%d" ,pkcs11_management_id_count ()); }
@@ -1350,7 +1350,7 @@* @return Return whether p has n (or at least n) parameters */ static bool -man_need (struct management *man,const char **p,const int n,unsigned int flags) +man_need (const struct management *man,const char **p,const int n,unsigned int flags) {int i;ASSERT (p[0 ]);
@@ -2365,7 +2365,7 @@* the route/ifconfig/open tun command. See doc/android.txt for details. */ bool -management_android_control (struct management *man,const char *command,const char *msg) +management_android_control (const struct management *man,const char *command,const char *msg) {if (!man) {
@@ -3013,7 +3013,7 @@ }void -management_up_down (struct management *man,const char *updown,const struct env_set *es) +management_up_down (const struct management *man,const char *updown,const struct env_set *es) {if (man->settings.flags &MF_UP_DOWN ) {
@@ -3023,13 +3023,13 @@ }void -management_notify (struct management *man,const char *severity,const char *type,const char *text) +management_notify (const struct management *man,const char *severity,const char *type,const char *text) {msg (M_CLIENT ,">NOTIFY:%s,%s,%s" , severity, type, text); }void -management_notify_generic (struct management *man,const char *str) +management_notify_generic (const struct management *man,const char *str) {msg (M_CLIENT ,"%s" , str); }
@@ -3115,7 +3115,8 @@ }void -management_notify_client_close (struct management *management,struct man_def_auth_context *mdac, +management_notify_client_close (const struct management *management, +struct man_def_auth_context *mdac,const struct env_set *es) {if ((mdac->flags &DAF_INITIAL_AUTH ) && !(mdac->flags &DAF_CONNECTION_CLOSED ))
@@ -3206,7 +3207,7 @@ }void -management_auth_failure (struct management *man,const char *type,const char *reason) +management_auth_failure (const struct management *man,const char *type,const char *reason) {if (reason) {
@@ -3219,7 +3220,7 @@ }void -management_auth_token (struct management *man,const char *token) +management_auth_token (const struct management *man,const char *token) {msg (M_CLIENT ,">PASSWORD:Auth-Token:%s" , token); }
src/openvpn/manage.h +6 -6
@@ -376,12 +376,12 @@void management_event_loop_n_seconds (struct management *man,int sec); -void management_up_down (struct management *man,const char *updown,const struct env_set *es); +void management_up_down (const struct management *man,const char *updown,const struct env_set *es); -void management_notify (struct management *man,const char *severity,const char *type, +void management_notify (const struct management *man,const char *severity,const char *type,const char *text); -void management_notify_generic (struct management *man,const char *str); +void management_notify_generic (const struct management *man,const char *str); void management_notify_client_needing_auth(struct management *management, const unsigned int auth_id,
@@ -391,7 +391,7 @@void management_connection_established (struct management *management,struct man_def_auth_context *mdac,const struct env_set *es); -void management_notify_client_close (struct management *management, +void management_notify_client_close (const struct management *management,struct man_def_auth_context *mdac,const struct env_set *es); void management_learn_addr(struct management *management, struct man_def_auth_context *mdac,
@@ -476,12 +476,12 @@* OpenVPN calls here to indicate a password failure */ -void management_auth_failure (struct management *man,const char *type,const char *reason); +void management_auth_failure (const struct management *man,const char *type,const char *reason);/* * Echo an authentication token to management interface */ -void management_auth_token (struct management *man,const char *token); +void management_auth_token (const struct management *man,const char *token);/* * These functions drive the bytecount in/out counters.
src/openvpn/mbuf.c +1 -1
@@ -160,7 +160,7 @@ }void -mbuf_dereference_instance (struct mbuf_set *ms,struct multi_instance *mi) +mbuf_dereference_instance (struct mbuf_set *ms,const struct multi_instance *mi) {if (ms) {
src/openvpn/mbuf.h +1 -1
@@ -75,7 +75,7 @@bool mbuf_extract_item (struct mbuf_set *ms,struct mbuf_item *item); -void mbuf_dereference_instance (struct mbuf_set *ms,struct multi_instance *mi); +void mbuf_dereference_instance (struct mbuf_set *ms,const struct multi_instance *mi);static inline bool mbuf_defined (const struct mbuf_set *ms)
src/openvpn/mss.c +9 -9
@@ -43,7 +43,7 @@* if yes, hand to mss_fixup_dowork() */ void -mss_fixup_ipv4 (struct buffer *buf,uint16_t maxmss) +mss_fixup_ipv4 (const struct buffer *buf,uint16_t maxmss) {const struct openvpn_iphdr *pip;int hlen;
@@ -80,7 +80,7 @@* (IPv6 header structure is sufficiently different from IPv4...) */ void -mss_fixup_ipv6 (struct buffer *buf,uint16_t maxmss) +mss_fixup_ipv6 (const struct buffer *buf,uint16_t maxmss) {const struct openvpn_ipv6hdr *pip6;struct buffer newbuf;
@@ -136,7 +136,7 @@*/ void -mss_fixup_dowork (struct buffer *buf,uint16_t maxmss) +mss_fixup_dowork (const struct buffer *buf,uint16_t maxmss) {int olen, optlen;uint8_t *opt;
@@ -239,8 +239,8 @@ }static void -frame_calculate_fragment (struct frame *frame,struct key_type *kt,const struct options *options, -struct link_socket_info *lsi) +frame_calculate_fragment (struct frame *frame,const struct key_type *kt,const struct options *options, +const struct link_socket_info *lsi) {#if defined(ENABLE_FRAGMENT )size_t overhead;
@@ -269,8 +269,8 @@ }static void -frame_calculate_mssfix (struct frame *frame,struct key_type *kt,const struct options *options, -struct link_socket_info *lsi) +frame_calculate_mssfix (struct frame *frame,const struct key_type *kt,const struct options *options, +const struct link_socket_info *lsi) {if (options->ce.mssfix_fixed) {
@@ -314,8 +314,8 @@ }void -frame_calculate_dynamic (struct frame *frame,struct key_type *kt,const struct options *options, -struct link_socket_info *lsi) +frame_calculate_dynamic (struct frame *frame,const struct key_type *kt,const struct options *options, +const struct link_socket_info *lsi) {if (options->ce.fragment >0 ) {
src/openvpn/mss.h +5 -5
@@ -29,15 +29,15 @@#include "socket.h" #include "ssl_common.h" -void mss_fixup_ipv4 (struct buffer *buf,uint16_t maxmss); +void mss_fixup_ipv4 (const struct buffer *buf,uint16_t maxmss); -void mss_fixup_ipv6 (struct buffer *buf,uint16_t maxmss); +void mss_fixup_ipv6 (const struct buffer *buf,uint16_t maxmss); -void mss_fixup_dowork (struct buffer *buf,uint16_t maxmss); +void mss_fixup_dowork (const struct buffer *buf,uint16_t maxmss);/** Set the --mssfix option. */ -void frame_calculate_dynamic (struct frame *frame,struct key_type *kt, -const struct options *options,struct link_socket_info *lsi); +void frame_calculate_dynamic (struct frame *frame,const struct key_type *kt, +const struct options *options,const struct link_socket_info *lsi);/** * Checks and adjusts the fragment and mssfix value according to the
src/openvpn/mtcp.c +1 -1
@@ -91,7 +91,7 @@ }bool -multi_tcp_instance_specific_init (struct multi_context *m,struct multi_instance *mi) +multi_tcp_instance_specific_init (const struct multi_context *m,struct multi_instance *mi) {/* buffer for queued TCP socket output packets */ mi->tcp_link_out_deferred =mbuf_init (m->top.options.n_bcast_buf);
src/openvpn/mtcp.h +1 -1
@@ -35,7 +35,7 @@void multi_tcp_dereference_instance (struct multi_io *multi_io,struct multi_instance *mi); -bool multi_tcp_instance_specific_init (struct multi_context *m,struct multi_instance *mi); +bool multi_tcp_instance_specific_init (const struct multi_context *m,struct multi_instance *mi);void multi_tcp_instance_specific_free (struct multi_instance *mi);
src/openvpn/mudp.c +2 -2
@@ -39,7 +39,7 @@static void send_hmac_reset_packet (struct multi_context *m,struct tls_pre_decrypt_state *state, -struct tls_auth_standalone *tas,struct session_id *sid, +const struct tls_auth_standalone *tas,const struct session_id *sid,bool request_resend_wkc) {reset_packet_id_send (&state->tls_wrap_tmp.opt.packet_id.send);
@@ -69,7 +69,7 @@enum first_packet_verdict verdict; -struct tls_auth_standalone *tas = m->top.c2.tls_auth_standalone; +const struct tls_auth_standalone *tas = m->top.c2.tls_auth_standalone; verdict =tls_pre_decrypt_lite (tas, state, &m->top.c2.from, &m->top.c2.buf);
src/openvpn/multi.c +8 -8
@@ -57,7 +57,7 @@#ifdef MULTI_DEBUG_EVENT_LOOP static const char * -id (struct multi_instance *mi) +id (const struct multi_instance *mi) {if (mi) {
@@ -1315,7 +1315,7 @@* same common name. */ static void -multi_delete_dup (struct multi_context *m,struct multi_instance *new_mi) +multi_delete_dup (struct multi_context *m,const struct multi_instance *new_mi) {if (new_mi) {
@@ -2260,7 +2260,7 @@ }static bool -multi_client_setup_dco_initial (struct multi_context *m,struct multi_instance *mi, +multi_client_setup_dco_initial (const struct multi_context *m,struct multi_instance *mi,struct gc_arena *gc) {if (!dco_enabled (&mi->context.options))
@@ -3195,7 +3195,7 @@#if defined(ENABLE_DCO )static void -process_incoming_del_peer (struct multi_context *m,struct multi_instance *mi,dco_context_t *dco) +process_incoming_del_peer (struct multi_context *m,struct multi_instance *mi,const dco_context_t *dco) {const char *reason ="ovpn-dco: unknown reason" ; switch (dco->dco_del_peer_reason)
@@ -4226,7 +4226,7 @@/* Searches for the address and deletes it if it is owned by the multi_instance */ static void -multi_unlearn_addr (struct multi_context *m,struct multi_instance *mi,const struct mroute_addr *addr) +multi_unlearn_addr (struct multi_context *m,const struct multi_instance *mi,const struct mroute_addr *addr) {struct hash_element *he;const uint32_t hv =hash_value (m->vhash, addr);
@@ -4261,7 +4261,7 @@* @param a The new IPv4 address in network byte order */ static void -multi_unlearn_in_addr_t (struct multi_context *m,struct multi_instance *mi,in_addr_t a) +multi_unlearn_in_addr_t (struct multi_context *m,const struct multi_instance *mi,in_addr_t a) {struct mroute_addr addr;CLEAR (addr);
@@ -4279,7 +4279,7 @@* @param a6 The new IPv6 address */ static void -multi_unlearn_in6_addr (struct multi_context *m,struct multi_instance *mi,struct in6_addr a6) +multi_unlearn_in6_addr (struct multi_context *m,const struct multi_instance *mi,struct in6_addr a6) {struct mroute_addr addr;CLEAR (addr);
@@ -4395,7 +4395,7 @@bool multi_check_push_ifconfig_ipv6_extra_route (struct multi_instance *mi, -struct in6_addr *dest) +const struct in6_addr *dest) {const struct options *o = &mi->context.options;
src/openvpn/multi.h +2 -2
@@ -520,7 +520,7 @@*/ static inline void -set_prefix (struct multi_instance *mi) +set_prefix (const struct multi_instance *mi) {#ifdef MULTI_DEBUG_EVENT_LOOP if (mi->msg_prefix[0 ])
@@ -694,7 +694,7 @@*/ bool multi_check_push_ifconfig_ipv6_extra_route (struct multi_instance *mi, -struct in6_addr *dest); +const struct in6_addr *dest);/* * Check for signals.
src/openvpn/networking.h +3 -3
@@ -44,7 +44,7 @@*/ #if !defined(ENABLE_IPROUTE )static inline int -net_ctx_init (struct context *c,openvpn_net_ctx_t *ctx) +net_ctx_init (const struct context *c,openvpn_net_ctx_t *ctx) { (void )c; (void )ctx;
@@ -75,7 +75,7 @@* * @return 0 on success, a negative error code otherwise */ -int net_ctx_init (struct context *c,openvpn_net_ctx_t *ctx); +int net_ctx_init (const struct context *c,openvpn_net_ctx_t *ctx);/** * Release resources allocated by the internal garbage collector
@@ -102,7 +102,7 @@* @return 0 on success, negative error code on error */ int net_iface_new (openvpn_net_ctx_t *ctx,const openvpn_net_iface_t *iface,const char *type, -void *arg); +const void *arg);/** * Retrieve the interface type
src/openvpn/networking_iproute2.c +2 -2
@@ -36,7 +36,7 @@#include <netinet/in.h> int -net_ctx_init (struct context *c,openvpn_net_ctx_t *ctx) +net_ctx_init (const struct context *c,openvpn_net_ctx_t *ctx) { ctx->es =NULL ;if (c)
@@ -61,7 +61,7 @@ }int -net_iface_new (openvpn_net_ctx_t *ctx,const char *iface,const char *type,void *arg) +net_iface_new (openvpn_net_ctx_t *ctx,const char *iface,const char *type,const void *arg) {struct argv argv =argv_new ();
src/openvpn/networking_sitnl.c +4 -4
@@ -987,7 +987,7 @@ }static int -sitnl_addr_del (sa_family_t af_family,const char *iface,inet_address_t *addr,int prefixlen) +sitnl_addr_del (sa_family_t af_family,const char *iface,const inet_address_t *addr,int prefixlen) {int ifindex;
@@ -1230,8 +1230,8 @@ }static int -sitnl_route_del (const char *iface,sa_family_t af_family,inet_address_t *dst,int prefixlen, -inet_address_t *gw,uint32_t table,int metric) +sitnl_route_del (const char *iface,sa_family_t af_family,const inet_address_t *dst,int prefixlen, +const inet_address_t *gw,uint32_t table,int metric) {int ifindex =0 ;
@@ -1308,7 +1308,7 @@int -net_iface_new (openvpn_net_ctx_t *ctx,const char *iface,const char *type,void *arg) +net_iface_new (openvpn_net_ctx_t *ctx,const char *iface,const char *type,const void *arg) {struct sitnl_link_req req = {};int ret =-1 ;
src/openvpn/occ.h +1 -1
@@ -156,7 +156,7 @@* via control channel. * @return control channel exit message should be used */ static inline bool -cc_exit_notify_enabled (struct context *c) +cc_exit_notify_enabled (const struct context *c) {/* Check if we have TLS active at all */ if (!c->c2.tls_multi)
src/openvpn/openssl_compat.h +2 -2
@@ -124,7 +124,7 @@/* Mimics the functions but only when the default context without * options is chosen */ static inline const EVP_CIPHER * -EVP_CIPHER_fetch (void *ctx,const char *algorithm,const char *properties) +EVP_CIPHER_fetch (const void *ctx,const char *algorithm,const char *properties) {ASSERT (!ctx);ASSERT (!properties);
@@ -132,7 +132,7 @@ }static inline const EVP_MD * -EVP_MD_fetch (void *ctx,const char *algorithm,const char *properties) +EVP_MD_fetch (const void *ctx,const char *algorithm,const char *properties) {ASSERT (!ctx);ASSERT (!properties);
src/openvpn/options.c +3 -3
@@ -3050,7 +3050,7 @@ }static void -options_postprocess_mutate_le (struct connection_entry *ce,struct local_entry *le,int mode) +options_postprocess_mutate_le (const struct connection_entry *ce,struct local_entry *le,int mode) {/* use the global port if none is specified */ if (!le->port)
@@ -4980,7 +4980,7 @@static bool verify_permission (const char *name,const char *file,int line,const uint64_t type,const uint64_t allowed,uint64_t *found,const msglvl_t msglevel, -struct options *options,bool is_inline) +const struct options *options,bool is_inline) {if (!(type & allowed)) {
@@ -5547,7 +5547,7 @@ }static void -show_compression_warning (struct compress_options *info) +show_compression_warning (const struct compress_options *info) {if (comp_non_stub_enabled (info)) {
src/openvpn/options_parse.c +2 -2
@@ -258,7 +258,7 @@ }static char * -read_inline_file (struct in_src *is,const char *close_tag,int *num_lines,struct gc_arena *gc) +read_inline_file (const struct in_src *is,const char *close_tag,int *num_lines,struct gc_arena *gc) {char line[OPTION_LINE_SIZE ];struct buffer buf =alloc_buf (8 *OPTION_LINE_SIZE );
@@ -302,7 +302,7 @@ }static int -check_inline_file (struct in_src *is,char *p[],struct gc_arena *gc) +check_inline_file (const struct in_src *is,char *p[],struct gc_arena *gc) {int num_inline_lines =0 ;
src/openvpn/otime.c +1 -1
@@ -66,7 +66,7 @@ }void -update_now_usec (struct timeval *tv) +update_now_usec (const struct timeval *tv) {const time_t last = now;update_now (tv->tv_sec);
src/openvpn/otime.h +1 -1
@@ -65,7 +65,7 @@void update_now (const time_t system_time);extern time_t now_usec; -void update_now_usec (struct timeval *tv); +void update_now_usec (const struct timeval *tv);static inline int openvpn_gettimeofday (struct timeval *tv,void *tz)
src/openvpn/proto.h +1 -1
@@ -248,7 +248,7 @@* and offset of IP header (via parameter). */ static inline int -get_tun_ip_ver (int tunnel_type,struct buffer *buf,int *ip_hdr_offset) +get_tun_ip_ver (int tunnel_type,const struct buffer *buf,int *ip_hdr_offset) {int ip_ver =-1 ;
src/openvpn/proxy.c +5 -4
@@ -527,8 +527,9 @@ }static bool -add_proxy_headers (struct http_proxy_info *p,socket_descriptor_t sd,/* already open to proxy */ -const char *host/* openvpn server remote */ +add_proxy_headers (const struct http_proxy_info *p, +socket_descriptor_t sd,/* already open to proxy */ +const char *host/* openvpn server remote */ ) {char buf[512 ];
@@ -597,8 +598,8 @@socket_descriptor_t sd,/* already open to proxy */ const char *host, /* openvpn server remote */ const char *port, /* openvpn server port */ - struct event_timeout *server_poll_timeout, struct buffer *lookahead, - struct signal_info *sig_info) + const struct event_timeout *server_poll_timeout, + struct buffer *lookahead, struct signal_info *sig_info) { struct gc_arena gc = gc_new();char buf[512 ];
src/openvpn/proxy.h +1 -1
@@ -89,7 +89,7 @@socket_descriptor_t sd,/* already open to proxy */ const char *host, /* openvpn server remote */ const char *port, /* openvpn server port */ - struct event_timeout *server_poll_timeout, + const struct event_timeout *server_poll_timeout, struct buffer *lookahead, struct signal_info *sig_info);uint8_t *make_base64_string2 (const uint8_t *str,int str_len,struct gc_arena *gc);
src/openvpn/ps.c +3 -3
@@ -332,7 +332,7 @@* the proxy can determine true client origin. */ static void -journal_add (const char *journal_dir,struct proxy_connection *pc,struct proxy_connection *cp) +journal_add (const char *journal_dir,const struct proxy_connection *pc,struct proxy_connection *cp) {struct openvpn_sockaddr from, to;
@@ -410,7 +410,7 @@static bool proxy_entry_new (struct proxy_connection **list,struct event_set *es,const struct openvpn_sockaddr server_addr,const socket_descriptor_t sd_client, -struct buffer *initial_data,const char *journal_dir) +const struct buffer *initial_data,const char *journal_dir) {socket_descriptor_t sd_server;int status;
@@ -1013,7 +1013,7 @@* call. */ void -port_share_redirect (struct port_share *ps,const struct buffer *head,socket_descriptor_t sd) +port_share_redirect (const struct port_share *ps,const struct buffer *head,socket_descriptor_t sd) {if (ps) {
src/openvpn/ps.h +1 -1
@@ -49,7 +49,7 @@bool is_openvpn_protocol (const struct buffer *buf); -void port_share_redirect (struct port_share *ps,const struct buffer *head,socket_descriptor_t sd); +void port_share_redirect (const struct port_share *ps,const struct buffer *head,socket_descriptor_t sd);#endif /* if PORT_SHARE */ #endif /* ifndef PS_H */
src/openvpn/push.c +1 -1
@@ -435,7 +435,7 @@#endif bool -send_auth_pending_messages (struct tls_multi *tls_multi,struct tls_session *session, +send_auth_pending_messages (const struct tls_multi *tls_multi,struct tls_session *session,const char *extra,unsigned int timeout) {struct key_state *ks = &session->key[KS_PRIMARY ];
src/openvpn/push.h +1 -1
@@ -117,7 +117,7 @@* doc/management-notes.txt under client-pending-auth for * more details on message format */ -bool send_auth_pending_messages (struct tls_multi *tls_multi,struct tls_session *session, +bool send_auth_pending_messages (const struct tls_multi *tls_multi,struct tls_session *session,const char *extra,unsigned int timeout);void send_restart (struct context *c,const char *kill_msg);
src/openvpn/push_util.c +1 -1
@@ -222,7 +222,7 @@/* Return true if the client supports push-update */ static bool -support_push_update (struct multi_instance *mi) +support_push_update (const struct multi_instance *mi) {ASSERT (mi->context.c2.tls_multi);const unsigned int iv_proto_peer =extract_iv_proto (mi->context.c2.tls_multi->peer_info);
src/openvpn/reliable.c +3 -3
@@ -92,7 +92,7 @@/* check if a particular packet_id is present in ack */ static inline bool -reliable_ack_packet_id_present (struct reliable_ack *ack,packet_id_type pid) +reliable_ack_packet_id_present (const struct reliable_ack *ack,packet_id_type pid) {for (int i =0 ; i < ack->len; ++i) {
@@ -733,7 +733,7 @@*/ void -reliable_mark_active_incoming (struct reliable *rel,struct buffer *buf,packet_id_type pid, +reliable_mark_active_incoming (struct reliable *rel,const struct buffer *buf,packet_id_type pid,int opcode) {for (int i =0 ; i < rel->size; ++i)
@@ -793,7 +793,7 @@/* delete a buffer previously activated by reliable_mark_active() */ void -reliable_mark_deleted (struct reliable *rel,struct buffer *buf) +reliable_mark_deleted (struct reliable *rel,const struct buffer *buf) {for (int i =0 ; i < rel->size; ++i) {
src/openvpn/reliable.h +4 -4
@@ -173,7 +173,7 @@* @li False, if there are packet IDs to be acknowledged. */ static inline bool -reliable_ack_empty (struct reliable_ack *ack) +reliable_ack_empty (const struct reliable_ack *ack) {return !ack->len; }
@@ -186,7 +186,7 @@* @returns the number of outstanding acks */ static inline int -reliable_ack_outstanding (struct reliable_ack *ack) +reliable_ack_outstanding (const struct reliable_ack *ack) {return ack->len; }
@@ -336,7 +336,7 @@* @param pid The packet's packet ID. * @param opcode The packet's opcode. */ -void reliable_mark_active_incoming (struct reliable *rel,struct buffer *buf,packet_id_type pid, +void reliable_mark_active_incoming (struct reliable *rel,const struct buffer *buf,packet_id_type pid,int opcode);/**
@@ -389,7 +389,7 @@* @param rel The reliable structure associated with the given buffer. * @param buf The buffer of the reliable entry which is to be removed. */ -void reliable_mark_deleted (struct reliable *rel,struct buffer *buf); +void reliable_mark_deleted (struct reliable *rel,const struct buffer *buf);/** @} name Functions for extracting incoming packets */
src/openvpn/route.c +7 -5
@@ -898,8 +898,9 @@ }static bool -add_bypass_routes (struct route_bypass *rb,in_addr_t gateway,const struct tuntap *tt, -unsigned int flags,const struct route_gateway_info *rgi, +add_bypass_routes (const struct route_bypass *rb,in_addr_t gateway, +const struct tuntap *tt,unsigned int flags, +const struct route_gateway_info *rgi,const struct env_set *es,openvpn_net_ctx_t *ctx) {int ret = true;
@@ -916,8 +917,9 @@ }static void -del_bypass_routes (struct route_bypass *rb,in_addr_t gateway,const struct tuntap *tt, -unsigned int flags,const struct route_gateway_info *rgi, +del_bypass_routes (const struct route_bypass *rb,in_addr_t gateway, +const struct tuntap *tt,unsigned int flags, +const struct route_gateway_info *rgi,const struct env_set *es,openvpn_net_ctx_t *ctx) {int i;
@@ -3942,7 +3944,7 @@#else /* if defined(_WIN32) */ static void -get_bypass_addresses (struct route_bypass *rb,const unsigned int flags)/* PLATFORM-SPECIFIC */ +get_bypass_addresses (struct route_bypass *rb,const unsigned int flags) { }
src/openvpn/schedule.c +1 -1
@@ -501,7 +501,7 @@ }int -schedule_debug (struct schedule *s,int *count,struct timeval *least) +schedule_debug (const struct schedule *s,int *count,struct timeval *least) {struct timeval min;struct timeval max;
src/openvpn/socket.c +13 -13
@@ -647,7 +647,7 @@ }static void -bind_local (struct link_socket *sock,const sa_family_t ai_family) +bind_local (const struct link_socket *sock,const sa_family_t ai_family) {/* bind to local address/port */ if (sock->bind_local)
@@ -914,8 +914,8 @@ }void -socket_bind (socket_descriptor_t sd,struct addrinfo *local,int ai_family,const char *prefix, -bool ipv6only) +socket_bind (socket_descriptor_t sd,const struct addrinfo *local,int ai_family, +const char *prefix,bool ipv6only) {struct gc_arena gc =gc_new ();
@@ -1123,8 +1123,8 @@* such as TCP. */ -static void stream_buf_init (struct stream_buf *sb,struct buffer *buf,const unsigned int sockflags, -const int proto); +static void stream_buf_init (struct stream_buf *sb,const struct buffer *buf, +const unsigned int sockflags,const int proto);static void stream_buf_close (struct stream_buf *sb);
@@ -1481,7 +1481,7 @@ }static void -phase2_set_socket_flags (struct link_socket *sock) +phase2_set_socket_flags (const struct link_socket *sock) {/* set misc socket parameters */ socket_set_flags (sock->sd, sock->sockflags);
@@ -2073,7 +2073,7 @@ }static void -stream_buf_init (struct stream_buf *sb,struct buffer *buf,const unsigned int sockflags, +stream_buf_init (struct stream_buf *sb,const struct buffer *buf,const unsigned int sockflags,const int proto) { sb->buf_init = *buf;
@@ -2337,7 +2337,7 @@#endif static socklen_t -link_socket_read_udp_posix_recvmsg (struct link_socket *sock,struct buffer *buf, +link_socket_read_udp_posix_recvmsg (const struct link_socket *sock,struct buffer *buf,struct link_socket_actual *from) {struct iovec iov;
@@ -2405,7 +2405,7 @@#endif /* if ENABLE_IP_PKTINFO */ int -link_socket_read_udp_posix (struct link_socket *sock,struct buffer *buf, +link_socket_read_udp_posix (const struct link_socket *sock,struct buffer *buf,struct link_socket_actual *from) {socklen_t fromlen =sizeof (from->dest.addr);
@@ -2462,7 +2462,7 @@#if ENABLE_IP_PKTINFO ssize_t -link_socket_write_udp_posix_sendmsg (struct link_socket *sock,struct buffer *buf, +link_socket_write_udp_posix_sendmsg (const struct link_socket *sock,const struct buffer *buf,struct link_socket_actual *to) {struct iovec iov;
@@ -2656,7 +2656,7 @@ }int -socket_send_queue (struct link_socket *sock,struct buffer *buf,const struct link_socket_actual *to) +socket_send_queue (struct link_socket *sock,const struct buffer *buf,const struct link_socket_actual *to) {if (sock->writes.iostate ==IOSTATE_INITIAL ) {
@@ -2756,8 +2756,8 @@return sock->writes.iostate; } -void -read_sockaddr_from_overlapped (struct overlapped_io *io,struct sockaddr *dst,int overlapped_ret) +static void +read_sockaddr_from_overlapped (const struct overlapped_io *io,struct sockaddr *dst,int overlapped_ret) {if (overlapped_ret >=0 && io->addr_defined) {
src/openvpn/socket.h +11 -9
@@ -267,7 +267,7 @@int socket_recv_queue (struct link_socket *sock,int maxsize); -int socket_send_queue (struct link_socket *sock,struct buffer *buf, +int socket_send_queue (struct link_socket *sock,const struct buffer *buf,const struct link_socket_actual *to); typedef struct
@@ -347,8 +347,8 @@struct link_socket *link_socket_new (void ); -void socket_bind (socket_descriptor_t sd,struct addrinfo *local,int af_family,const char *prefix, -bool ipv6only); +void socket_bind (socket_descriptor_t sd,const struct addrinfo *local,int af_family, +const char *prefix,bool ipv6only);int openvpn_connect (socket_descriptor_t sd,const struct sockaddr *remote,int connect_timeout,volatile int *signal_received);
@@ -484,7 +484,7 @@ }static inline bool -link_socket_verify_incoming_addr (struct buffer *buf,const struct link_socket_info *info, +link_socket_verify_incoming_addr (const struct buffer *buf,const struct link_socket_info *info,const struct link_socket_actual *from_addr) {if (buf->len >0 )
@@ -608,7 +608,7 @@#else /* ifdef _WIN32 */ -int link_socket_read_udp_posix (struct link_socket *sock,struct buffer *buf, +int link_socket_read_udp_posix (const struct link_socket *sock,struct buffer *buf,struct link_socket_actual *from);#endif /* ifdef _WIN32 */
@@ -694,12 +694,12 @@#else /* ifdef _WIN32 */ -ssize_t link_socket_write_udp_posix_sendmsg (struct link_socket *sock,struct buffer *buf, +ssize_t link_socket_write_udp_posix_sendmsg (const struct link_socket *sock,const struct buffer *buf,struct link_socket_actual *to);static inline ssize_t -link_socket_write_udp_posix (struct link_socket *sock,struct buffer *buf, +link_socket_write_udp_posix (const struct link_socket *sock,const struct buffer *buf,struct link_socket_actual *to) {#if ENABLE_IP_PKTINFO
@@ -715,7 +715,7 @@ }static inline ssize_t -link_socket_write_tcp_posix (struct link_socket *sock,struct buffer *buf) +link_socket_write_tcp_posix (const struct link_socket *sock,const struct buffer *buf) {return send (sock->sd,BPTR (buf),BLENZ (buf),MSG_NOSIGNAL ); }
@@ -773,7 +773,7 @@* from tunnel packet. */ static inline void -link_socket_set_tos (struct link_socket *sock) +link_socket_set_tos (const struct link_socket *sock) {if (sock && sock->ptos_defined) {
@@ -819,6 +819,8 @@ } } +/* cppcheck-suppress constParameterPointer +* sock is modified on Windows via &sock->listen_handle */ static inline void socket_reset_listen_persistent (struct link_socket *sock) {
src/openvpn/socket_util.h +1 -1
@@ -439,7 +439,7 @@static inline bool -addrlist_match_proto (const struct openvpn_sockaddr *a1,struct addrinfo *addr_list,const int proto) +addrlist_match_proto (const struct openvpn_sockaddr *a1,const struct addrinfo *addr_list,const int proto) {return link_socket_proto_connection_oriented (proto) ?addrlist_match (a1, addr_list) :addrlist_port_match (a1, addr_list);
src/openvpn/socks.c +10 -10
@@ -82,7 +82,7 @@static bool socks_proxy_recv_char (uint8_t *c,const char *name,socket_descriptor_t sd, -struct event_timeout *server_poll_timeout, +const struct event_timeout *server_poll_timeout,volatile int *signal_received) {fd_set reads;
@@ -97,8 +97,8 @@ }static bool -socks_username_password_auth (struct socks_proxy_info *p,socket_descriptor_t sd, -struct event_timeout *server_poll_timeout, +socks_username_password_auth (const struct socks_proxy_info *p,socket_descriptor_t sd, +const struct event_timeout *server_poll_timeout,volatile int *signal_received) {char to_send[516 ];
@@ -156,8 +156,8 @@ }static bool -socks_handshake (struct socks_proxy_info *p,socket_descriptor_t sd, -struct event_timeout *server_poll_timeout,volatile int *signal_received) +socks_handshake (const struct socks_proxy_info *p,socket_descriptor_t sd, +const struct event_timeout *server_poll_timeout,volatile int *signal_received) {uint8_t buf[2 ];int len =0 ;
@@ -231,7 +231,7 @@static bool recv_socks_reply (socket_descriptor_t sd,struct openvpn_sockaddr *addr, -struct event_timeout *server_poll_timeout,volatile int *signal_received) +const struct event_timeout *server_poll_timeout,volatile int *signal_received) {uint8_t atyp =0 ;int alen =0 ;
@@ -334,11 +334,11 @@ }void -establish_socks_proxy_passthru (struct socks_proxy_info *p, +establish_socks_proxy_passthru (const struct socks_proxy_info *p,socket_descriptor_t sd,/* already open to proxy */ const char *host,/* openvpn server remote */ const char *servname,/* openvpn server port */ -struct event_timeout *server_poll_timeout, +const struct event_timeout *server_poll_timeout,struct signal_info *sig_info) {char buf[270 ];
@@ -392,10 +392,10 @@ }void -establish_socks_proxy_udpassoc (struct socks_proxy_info *p, +establish_socks_proxy_udpassoc (const struct socks_proxy_info *p,socket_descriptor_t ctrl_sd,/* already open to proxy */ struct openvpn_sockaddr *relay_addr, -struct event_timeout *server_poll_timeout, +const struct event_timeout *server_poll_timeout,struct signal_info *sig_info) {if (!socks_handshake (p, ctrl_sd, server_poll_timeout, &sig_info->signal_received))
src/openvpn/socks.h +4 -4
@@ -47,17 +47,17 @@void socks_proxy_close (struct socks_proxy_info *sp); -void establish_socks_proxy_passthru (struct socks_proxy_info *p, +void establish_socks_proxy_passthru (const struct socks_proxy_info *p,socket_descriptor_t sd,/* already open to proxy */ const char *host,/* openvpn server remote */ const char *servname,/* openvpn server port */ -struct event_timeout *server_poll_timeout, +const struct event_timeout *server_poll_timeout,struct signal_info *sig_info); -void establish_socks_proxy_udpassoc (struct socks_proxy_info *p, +void establish_socks_proxy_udpassoc (const struct socks_proxy_info *p,socket_descriptor_t ctrl_sd,/* already open to proxy */ struct openvpn_sockaddr *relay_addr, -struct event_timeout *server_poll_timeout, +const struct event_timeout *server_poll_timeout,struct signal_info *sig_info);void socks_process_incoming_udp (struct buffer *buf,struct link_socket_actual *from);
src/openvpn/ssl.c +12 -11
@@ -1159,7 +1159,7 @@ }struct tls_multi * -tls_multi_init (struct tls_options *tls_options) +tls_multi_init (const struct tls_options *tls_options) {struct tls_multi *ret;
@@ -1188,7 +1188,7 @@*/ struct tls_auth_standalone * -tls_auth_standalone_init (struct tls_options *tls_options,struct gc_arena *gc) +tls_auth_standalone_init (const struct tls_options *tls_options,struct gc_arena *gc) {struct tls_auth_standalone *tas;
@@ -1336,7 +1336,7 @@static void init_epoch_keys (struct key_state *ks,struct tls_multi *multi,const struct key_type *key_type, -bool server,struct key2 *key2) +bool server,const struct key2 *key2) {/* For now we hardcode this to be 16 for the software based data channel * DCO based implementations/HW implementation might adjust this number
@@ -1375,7 +1375,7 @@static void init_key_contexts (struct key_state *ks,struct tls_multi *multi,const struct key_type *key_type, -bool server,struct key2 *key2,bool dco_enabled) +bool server,const struct key2 *key2,bool dco_enabled) {struct key_ctx_bi *key = &ks->crypto_options.key_ctx_bi;
@@ -1573,8 +1573,9 @@bool tls_session_update_crypto_params_do_work (struct tls_multi *multi,struct tls_session *session, -struct options *options,struct frame *frame, -struct frame *frame_fragment,struct link_socket_info *lsi, +const struct options *options,struct frame *frame, +struct frame *frame_fragment, +const struct link_socket_info *lsi,dco_context_t *dco) {if (session->key[KS_PRIMARY ].crypto_options.key_ctx_bi.initialized)
@@ -1643,7 +1644,7 @@bool tls_session_update_crypto_params (struct tls_multi *multi,struct tls_session *session,struct options *options,struct frame *frame, -struct frame *frame_fragment,struct link_socket_info *lsi, +struct frame *frame_fragment,const struct link_socket_info *lsi,dco_context_t *dco) {if (!check_session_cipher (session, options))
@@ -2495,8 +2496,8 @@ }bool -session_skip_to_pre_start (struct tls_session *session,struct tls_pre_decrypt_state *state, -struct link_socket_actual *from) +session_skip_to_pre_start (struct tls_session *session,const struct tls_pre_decrypt_state *state, +const struct link_socket_actual *from) {struct key_state *ks = &session->key[KS_PRIMARY ]; ks->session_id_remote = state->peer_session_id;
@@ -4011,7 +4012,7 @@ }void -tls_post_encrypt (struct tls_multi *multi,struct buffer *buf) +tls_post_encrypt (struct tls_multi *multi,const struct buffer *buf) {struct key_state *ks = multi->save_ks; multi->save_ks =NULL ;
@@ -4142,7 +4143,7 @@* into a garbage collectable string which is returned. */ const char * -protocol_dump (struct buffer *buffer,unsigned int flags,struct gc_arena *gc) +protocol_dump (const struct buffer *buffer,unsigned int flags,struct gc_arena *gc) {struct buffer out =alloc_buf_gc (256 , gc);struct buffer buf = *buffer;
src/openvpn/ssl.h +8 -7
@@ -166,7 +166,7 @@* * @return A newly allocated and initialized \c tls_multi structure. */ -struct tls_multi *tls_multi_init (struct tls_options *tls_options); +struct tls_multi *tls_multi_init (const struct tls_options *tls_options);/** * Finalize initialization of a \c tls_multi structure.
@@ -187,7 +187,7 @@/* * Initialize a standalone tls-auth verification object. */ -struct tls_auth_standalone *tls_auth_standalone_init (struct tls_options *tls_options, +struct tls_auth_standalone *tls_auth_standalone_init (const struct tls_options *tls_options,struct gc_arena *gc);/**
@@ -371,7 +371,7 @@* @param multi - The TLS state for this packet's destination VPN tunnel. * @param buf - The buffer containing the outgoing packet. */ -void tls_post_encrypt (struct tls_multi *multi,struct buffer *buf); +void tls_post_encrypt (struct tls_multi *multi,const struct buffer *buf);/** @} name Functions for managing security parameter state for data channel packets */
@@ -461,7 +461,8 @@*/ bool tls_session_update_crypto_params (struct tls_multi *multi,struct tls_session *session,struct options *options,struct frame *frame, -struct frame *frame_fragment,struct link_socket_info *lsi, +struct frame *frame_fragment, +const struct link_socket_info *lsi,dco_context_t *dco);/*
@@ -525,7 +526,7 @@#define PD_VERBOSE (1 << 10)#define PD_TLS_CRYPT (1 << 11) -const char *protocol_dump (struct buffer *buffer,unsigned int flags,struct gc_arena *gc); +const char *protocol_dump (const struct buffer *buffer,unsigned int flags,struct gc_arena *gc);/* * debugging code
@@ -573,7 +574,7 @@/* Special method to skip the three way handshake RESET stages. This is * used by the HMAC code when seeing a packet that matches the previous * HMAC based stateless server state */ -bool session_skip_to_pre_start (struct tls_session *session,struct tls_pre_decrypt_state *state, -struct link_socket_actual *from); +bool session_skip_to_pre_start (struct tls_session *session,const struct tls_pre_decrypt_state *state, +const struct link_socket_actual *from);#endif /* ifndef OPENVPN_SSL_H */
src/openvpn/ssl_backend.h +2 -2
@@ -144,7 +144,7 @@* * @return true if the context is initialised, false if not. */ -bool tls_ctx_initialised (struct tls_root_ctx *ctx); +bool tls_ctx_initialised (const struct tls_root_ctx *ctx);/** * Set any library specific options.
@@ -177,7 +177,7 @@* @param ciphers String containing : delimited cipher names, or NULL to use * sane defaults. */ -void tls_ctx_restrict_ciphers_tls13 (struct tls_root_ctx *ctx,const char *ciphers); +void tls_ctx_restrict_ciphers_tls13 (const struct tls_root_ctx *ctx,const char *ciphers);/** * Set the TLS certificate profile. The profile defines which crypto
src/openvpn/ssl_mbedtls.c +2 -2
@@ -161,7 +161,7 @@ }bool -tls_ctx_initialised (struct tls_root_ctx *ctx) +tls_ctx_initialised (const struct tls_root_ctx *ctx) {/* either this should be NULL or should be non-null and then have a * valid TLS ctx inside as well */
@@ -284,7 +284,7 @@ }void -tls_ctx_restrict_ciphers_tls13 (struct tls_root_ctx *ctx,const char *ciphers) +tls_ctx_restrict_ciphers_tls13 (const struct tls_root_ctx *ctx,const char *ciphers) {if (ciphers ==NULL ) {
src/openvpn/ssl_openssl.c +5 -5
@@ -147,7 +147,7 @@ }bool -tls_ctx_initialised (struct tls_root_ctx *ctx) +tls_ctx_initialised (const struct tls_root_ctx *ctx) {/* either this should be NULL or should be non-null and then have a * valid TLS ctx inside as well */
@@ -509,7 +509,7 @@#endif void -tls_ctx_restrict_ciphers_tls13 (struct tls_root_ctx *ctx,const char *ciphers) +tls_ctx_restrict_ciphers_tls13 (const struct tls_root_ctx *ctx,const char *ciphers) {if (ciphers ==NULL ) {
@@ -1165,7 +1165,7 @@ }static void -tls_ctx_load_cert_uri (struct tls_root_ctx *tls_ctx,const char *uri) +tls_ctx_load_cert_uri (const struct tls_root_ctx *tls_ctx,const char *uri) {#if defined(HAVE_OPENSSL_STORE_API )X509 *x =NULL ;
@@ -2078,7 +2078,7 @@ }static void -bio_debug_data (const char *mode,BIO *bio,const uint8_t *buf,int len,const char *desc) +bio_debug_data (const char *mode,const BIO *bio,const uint8_t *buf,int len,const char *desc) {struct gc_arena gc =gc_new ();if (len >0 )
@@ -2092,7 +2092,7 @@ }static void -bio_debug_oc (const char *mode,BIO *bio) +bio_debug_oc (const char *mode,const BIO *bio) {open_biofp (); fprintf(biofp, "BIO %s time=%" PRIi64 " bio=" ptr_format "\n", mode, (int64_t)time(NULL),
src/openvpn/ssl_pkt.c +5 -5
@@ -57,7 +57,7 @@* @return if the swap was successful (buf was large enough) */ static bool -swap_hmac (struct buffer *buf,const struct crypto_options *co,bool incoming) +swap_hmac (const struct buffer *buf,const struct crypto_options *co,bool incoming) {ASSERT (co);
@@ -117,7 +117,7 @@*/ static void tls_wrap_control (struct tls_wrap_ctx *ctx,uint8_t header,struct buffer *buf, -struct session_id *session_id) +const struct session_id *session_id) {if (ctx->mode ==TLS_WRAP_AUTH || ctx->mode ==TLS_WRAP_NONE ) {
@@ -403,9 +403,9 @@struct buffer -tls_reset_standalone (struct tls_wrap_ctx *ctx,struct tls_auth_standalone *tas, -struct session_id *own_sid,struct session_id *remote_sid,uint8_t header, -bool request_resend_wkc) +tls_reset_standalone (struct tls_wrap_ctx *ctx,const struct tls_auth_standalone *tas, +const struct session_id *own_sid,const struct session_id *remote_sid, +uint8_t header,bool request_resend_wkc) {/* Copy buffer here to point at the same data but allow tls_wrap_control * to potentially change buf to point to another buffer without
src/openvpn/ssl_pkt.h +3 -2
@@ -220,8 +220,9 @@* from the tls pre decrypt state. * */ -struct buffer tls_reset_standalone (struct tls_wrap_ctx *ctx,struct tls_auth_standalone *tas, -struct session_id *own_sid,struct session_id *remote_sid, +struct buffer tls_reset_standalone (struct tls_wrap_ctx *ctx,const struct tls_auth_standalone *tas, +const struct session_id *own_sid, +const struct session_id *remote_sid,uint8_t header,bool request_resend_wkc);
src/openvpn/ssl_verify.c +4 -4
@@ -1137,7 +1137,7 @@* cache. */ static bool -tls_authentication_status_use_cache (struct tls_multi *multi) +tls_authentication_status_use_cache (const struct tls_multi *multi) {unsigned int idx =min_uint (multi->tas_cache_num_updates,SIZE (cache_intervals) -1 );time_t latency = cache_intervals[idx];
@@ -1281,7 +1281,7 @@* Check if the script/plugin left a message in the auth failed message * file and relay it to the user */ static void -check_for_client_reason (struct tls_multi *multi,struct auth_deferred_status *status) +check_for_client_reason (struct tls_multi *multi,const struct auth_deferred_status *status) {struct gc_arena gc =gc_new ();const char *msg =key_state_check_auth_failed_message_file (status, &gc);
@@ -1550,7 +1550,7 @@#endif /* ifdef ENABLE_MANAGEMENT */ static bool -set_verify_user_pass_env (struct user_pass *up,struct tls_multi *multi,struct tls_session *session) +set_verify_user_pass_env (const struct user_pass *up,struct tls_multi *multi,struct tls_session *session) {/* Is username defined? */ if ((session->opt->ssl_flags &SSLF_AUTH_USER_PASS_OPTIONAL ) ||strlen (up->username))
@@ -1578,7 +1578,7 @@ }bool -ssl_verify_username_length (struct tls_session *session,const char *username) +ssl_verify_username_length (const struct tls_session *session,const char *username) {if ((session->opt->ssl_flags &SSLF_USERNAME_AS_COMMON_NAME ) &&strlen (username) >TLS_USERNAME_LEN )
src/openvpn/ssl_verify.h +2 -2
@@ -202,7 +202,7 @@* @return true if name is under limit or username-as-common-name * is not active */ -bool ssl_verify_username_length (struct tls_session *session,const char *username); +bool ssl_verify_username_length (const struct tls_session *session,const char *username);/** * Runs the --client-crresponse script if one is defined.
@@ -275,7 +275,7 @@void auth_set_client_reason (struct tls_multi *multi,const char *client_reason);static inline const char * -tls_client_reason (struct tls_multi *multi) +tls_client_reason (const struct tls_multi *multi) {return multi->client_reason; }
src/openvpn/status.c +1 -1
@@ -135,7 +135,7 @@ }void -status_reset (struct status_output *so) +status_reset (const struct status_output *so) {if (so && so->fd >=0 ) {
src/openvpn/status.h +1 -1
@@ -69,7 +69,7 @@bool status_trigger (struct status_output *so); -void status_reset (struct status_output *so); +void status_reset (const struct status_output *so);void status_flush (struct status_output *so);
src/openvpn/tun.c +18 -18
@@ -835,7 +835,7 @@const char *ifconfig_ipv6_local_parm,/* --ifconfig parm 1 IPv6 */ int ifconfig_ipv6_netbits_parm, const char *ifconfig_ipv6_remote_parm, /* --ifconfig parm 2 IPv6 */ - struct addrinfo *local_public, struct addrinfo *remote_public, const bool strict_warn, + const struct addrinfo *local_public, const struct addrinfo *remote_public, const bool strict_warn, struct env_set *es, openvpn_net_ctx_t *ctx, struct tuntap *tt) { if (!tt)
@@ -978,7 +978,7 @@* -> helper function to simplify code below */ static void -add_route_connected_v6_net (struct tuntap *tt,const struct env_set *es) +add_route_connected_v6_net (const struct tuntap *tt,const struct env_set *es) {struct route_ipv6 r6;
@@ -1020,7 +1020,7 @@*/ in_addr_t -create_arbitrary_remote (struct tuntap *tt) +create_arbitrary_remote (const struct tuntap *tt) {in_addr_t remote;
@@ -1592,7 +1592,7 @@ }static void -undo_ifconfig_ipv4 (struct tuntap *tt,openvpn_net_ctx_t *ctx) +undo_ifconfig_ipv4 (const struct tuntap *tt,openvpn_net_ctx_t *ctx) {#if defined(TARGET_LINUX )int netbits =netmask_to_netbits2 (tt->remote_netmask);
@@ -1627,7 +1627,7 @@ }static void -undo_ifconfig_ipv6 (struct tuntap *tt,openvpn_net_ctx_t *ctx) +undo_ifconfig_ipv6 (const struct tuntap *tt,openvpn_net_ctx_t *ctx) {#if defined(TARGET_LINUX )if (net_addr_v6_del (ctx, tt->actual_name, &tt->local_ipv6, tt->netbits_ipv6) <0 )
@@ -1652,7 +1652,7 @@ }void -undo_ifconfig (struct tuntap *tt,openvpn_net_ctx_t *ctx) +undo_ifconfig (const struct tuntap *tt,openvpn_net_ctx_t *ctx) {if (tt->backend_driver !=DRIVER_NULL && tt->backend_driver !=DRIVER_AFUNIX ) {
@@ -1808,7 +1808,7 @@#if defined(TARGET_LINUX ) || defined(TARGET_FREEBSD )static bool -tun_dco_enabled (struct tuntap *tt) +tun_dco_enabled (const struct tuntap *tt) {return tt->backend_driver ==DRIVER_DCO ; }
@@ -2055,13 +2055,13 @@ }ssize_t -write_tun (struct tuntap *tt,uint8_t *buf,int len) +write_tun (const struct tuntap *tt,const uint8_t *buf,int len) {return write (tt->fd, buf, len); }ssize_t -read_tun (struct tuntap *tt,uint8_t *buf,int len) +read_tun (const struct tuntap *tt,const uint8_t *buf,int len) {return read (tt->fd, buf, len); }
@@ -2260,13 +2260,13 @@ }ssize_t -write_tun (struct tuntap *tt,uint8_t *buf,int len) +write_tun (const struct tuntap *tt,const uint8_t *buf,int len) {return write (tt->fd, buf, len); }ssize_t -read_tun (struct tuntap *tt,uint8_t *buf,int len) +read_tun (const struct tuntap *tt,uint8_t *buf,int len) {return read (tt->fd, buf, len); }
@@ -2596,7 +2596,7 @@ }ssize_t -write_tun (struct tuntap *tt,uint8_t *buf,int len) +write_tun (const struct tuntap *tt,const uint8_t *buf,int len) {struct strbuf sbuf; sbuf.len = len;
@@ -2605,7 +2605,7 @@ }ssize_t -read_tun (struct tuntap *tt,uint8_t *buf,int len) +read_tun (const struct tuntap *tt,uint8_t *buf,int len) {struct strbuf sbuf;int f =0 ;
@@ -3320,7 +3320,7 @@ }int -tun_write_queue (struct tuntap *tt,struct buffer *buf) +tun_write_queue (struct tuntap *tt,const struct buffer *buf) {if (tt->writes.iostate ==IOSTATE_INITIAL ) {
@@ -3375,7 +3375,7 @@ }int -tun_write_win32 (struct tuntap *tt,struct buffer *buf) +tun_write_win32 (struct tuntap *tt,const struct buffer *buf) {int err =0 ;int status =0 ;
@@ -5383,7 +5383,7 @@ }void -fork_register_dns_action (struct tuntap *tt) +fork_register_dns_action (const struct tuntap *tt) {if (tt && tt->options.register_dns && tt->options.msg_channel) {
@@ -5473,7 +5473,7 @@ }static void -tuntap_get_mtu (struct tuntap *tt) +tuntap_get_mtu (const struct tuntap *tt) {ULONG mtu =0 ;DWORD len;
@@ -6048,7 +6048,7 @@ }void -tun_show_debug (struct tuntap *tt) +tun_show_debug (const struct tuntap *tt) {if (tt->backend_driver ==WINDOWS_DRIVER_TAP_WINDOWS6 ) {
src/openvpn/tun.h +15 -15
@@ -272,9 +272,9 @@void close_tun_handle (struct tuntap *tt); -ssize_t write_tun (struct tuntap *tt,uint8_t *buf,int len); +ssize_t write_tun (const struct tuntap *tt,const uint8_t *buf,int len); -ssize_t read_tun (struct tuntap *tt,uint8_t *buf,int len); +ssize_t read_tun (const struct tuntap *tt,uint8_t *buf,int len);#ifdef ENABLE_FEATURE_TUN_PERSIST void tuncfg(const char *dev, const char *dev_type, const char *dev_node, int persist_mode,
@@ -293,7 +293,7 @@const char *ifconfig_ipv6_local_parm,/* --ifconfig parm 1 / IPv6 */ int ifconfig_ipv6_netbits_parm, /* --ifconfig parm 1 / bits */ const char *ifconfig_ipv6_remote_parm, /* --ifconfig parm 2 / IPv6 */ - struct addrinfo *local_public, struct addrinfo *remote_public, + const struct addrinfo *local_public, const struct addrinfo *remote_public, const bool strict_warn, struct env_set *es, openvpn_net_ctx_t *ctx, struct tuntap *tt);
@@ -320,7 +320,7 @@* @param tt the tuntap interface context * @param ctx the networking API opaque context */ -void undo_ifconfig (struct tuntap *tt,openvpn_net_ctx_t *ctx); +void undo_ifconfig (const struct tuntap *tt,openvpn_net_ctx_t *ctx);bool is_dev_type (const char *dev,const char *dev_type,const char *match_type);
@@ -351,7 +351,7 @@#define IFCONFIG_DEFAULT IFCONFIG_AFTER_TUN_OPENstatic inline int -ifconfig_order (struct tuntap *tt) +ifconfig_order (const struct tuntap *tt) {if (tt->backend_driver ==DRIVER_AFUNIX ) {
@@ -381,7 +381,7 @@#define ROUTE_ORDER_DEFAULT ROUTE_AFTER_TUNstatic inline int -route_order (struct tuntap *tt) +route_order (const struct tuntap *tt) {if (tt->backend_driver ==DRIVER_AFUNIX ) {
@@ -454,13 +454,13 @@const char *tap_win_getinfo (const struct tuntap *tt,struct gc_arena *gc); -void tun_show_debug (struct tuntap *tt); +void tun_show_debug (const struct tuntap *tt);bool dhcp_release_by_adapter_index (const DWORD adapter_index);bool dhcp_renew_by_adapter_index (const DWORD adapter_index); -void fork_register_dns_action (struct tuntap *tt); +void fork_register_dns_action (const struct tuntap *tt);void ipconfig_register_dns (const struct env_set *es);
@@ -470,7 +470,7 @@int tun_read_queue (struct tuntap *tt,int maxsize); -int tun_write_queue (struct tuntap *tt,struct buffer *buf); +int tun_write_queue (struct tuntap *tt,const struct buffer *buf);static inline bool tuntap_stop (int status)
@@ -529,13 +529,13 @@ }static inline bool -tuntap_is_dco_win (struct tuntap *tt) +tuntap_is_dco_win (const struct tuntap *tt) {return tt && tt->backend_driver ==DRIVER_DCO ; }static inline bool -tuntap_is_dco_win_timeout (struct tuntap *tt,int status) +tuntap_is_dco_win_timeout (const struct tuntap *tt,int status) {return tuntap_is_dco_win (tt) && (status <0 ) && (openvpn_errno () ==ERROR_NETNAME_DELETED ); }
@@ -555,25 +555,25 @@ }static inline void -tun_standby_init (struct tuntap *tt) +tun_standby_init (const struct tuntap *tt) { }static inline bool -tun_standby (struct tuntap *tt) +tun_standby (const struct tuntap *tt) {return true; }static inline bool -tuntap_is_dco_win (struct tuntap *tt) +tuntap_is_dco_win (const struct tuntap *tt) {return false; }static inline bool -tuntap_is_dco_win_timeout (struct tuntap *tt,int status) +tuntap_is_dco_win_timeout (const struct tuntap *tt,int status) {return false; }
src/openvpn/tun_afunix.c +2 -2
@@ -48,7 +48,7 @@static void -tun_afunix_exec_child (const char *dev_node,struct tuntap *tt,struct env_set *env) +tun_afunix_exec_child (const char *dev_node,struct tuntap *tt,const struct env_set *env) {const char *msgprefix ="ERROR: failure executing process for tun:" ;struct argv argv =argv_new ();
@@ -73,7 +73,7 @@ }void -open_tun_afunix (struct options *o,int mtu,struct tuntap *tt,struct env_set *orig_env) +open_tun_afunix (const struct options *o,int mtu,struct tuntap *tt,const struct env_set *orig_env) {struct gc_arena gc =gc_new ();
src/openvpn/tun_afunix.h +1 -1
@@ -31,7 +31,7 @@* the user provided taking care of implementing the actual tun * device. */ -void open_tun_afunix (struct options *o,int mtu,struct tuntap *tt,struct env_set *env); +void open_tun_afunix (const struct options *o,int mtu,struct tuntap *tt,const struct env_set *env);/**
src/openvpn/vlan.c +1 -1
@@ -288,7 +288,7 @@ }void -vlan_process_outgoing_tun (struct multi_context *m,struct multi_instance *mi) +vlan_process_outgoing_tun (const struct multi_context *m,struct multi_instance *mi) {if (!m->top.options.vlan_tagging) {
src/openvpn/vlan.h +1 -1
@@ -35,6 +35,6 @@bool vlan_is_tagged (const struct buffer *buf); -void vlan_process_outgoing_tun (struct multi_context *m,struct multi_instance *mi); +void vlan_process_outgoing_tun (const struct multi_context *m,struct multi_instance *mi);#endif /* VLAN_H */
src/openvpn/win32.h +1 -1
@@ -226,7 +226,7 @@void overlapped_io_close (struct overlapped_io *o);static inline bool -overlapped_io_active (struct overlapped_io *o) +overlapped_io_active (const struct overlapped_io *o) {return o->iostate ==IOSTATE_QUEUED || o->iostate ==IOSTATE_IMMEDIATE_RETURN ; }
src/openvpnmsica/openvpnmsica.c +1 -1
@@ -77,7 +77,7 @@* @return ERROR_SUCCESS on success; An error code otherwise */ static UINT -setup_sequence(_In_ MSIHANDLE hInstall, _In_z_ LPCWSTR szProperty, _In_ struct msica_arg_seq *seq) +setup_sequence(_In_ MSIHANDLE hInstall, _In_z_ LPCWSTR szProperty, _In_ const struct msica_arg_seq *seq) {UINT uiResult;LPWSTR szSequence =msica_arg_seq_join (seq);
src/openvpnserv/interactive.c +2 -2
@@ -521,7 +521,7 @@static SOCKADDR_INET -sockaddr_inet (short family,inet_address_t *addr) +sockaddr_inet (short family,const inet_address_t *addr) {SOCKADDR_INET sa_inet;ZeroMemory (&sa_inet,sizeof (sa_inet));
@@ -3733,7 +3733,7 @@static DWORD UpdateWaitHandles (LPHANDLE *handles_ptr,LPDWORD count,HANDLE io_event,HANDLE exit_event, -list_item_t *threads) +const list_item_t *threads) {static DWORD size =10 ;static LPHANDLE handles =NULL ;
tests/unit_tests/openvpn/mock_management.c +1 -1
@@ -36,7 +36,7 @@struct management *management;/* GLOBAL */ void -management_auth_failure (struct management *man,const char *type,const char *reason) +management_auth_failure (const struct management *man,const char *type,const char *reason) {ASSERT (false); }
tests/unit_tests/openvpn/test_misc.c +1 -1
@@ -146,7 +146,7 @@ }static struct hash_element * -hash_lookup_by_value (struct hash *hash,void *value) +hash_lookup_by_value (struct hash *hash,const void *value) {struct hash_iterator hi;struct hash_element *he;
tests/unit_tests/openvpn/test_user_pass.c +1 -1
@@ -59,7 +59,7 @@return mock (); }void -management_auth_failure (struct management *man,const char *type,const char *reason) +management_auth_failure (const struct management *man,const char *type,const char *reason) {assert_true (0 ); }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1663?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I56248cf6d199c2da770774b8fd1e5daf2b116f58
Gerrit-Change-Number: 1663
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1663?usp=email
to look at the new patch set (#4).
Change subject: Remove instances of constParameterPointer cppcheck warnings
......................................................................
Remove instances of constParameterPointer cppcheck warnings
This requires a few suppressions since cppcheck
doesn't quite understand the different code-paths
implemented by preprocessor defines.
---
M dev-tools/cppcheck-suppression
M sample/sample-plugins/client-connect/sample-client-connect.c
M sample/sample-plugins/defer/multi-auth.c
M sample/sample-plugins/keying-material-exporter-demo/keyingmaterialexporter.c M src/openvpn/buffer.c
M src/openvpn/buffer.h
M src/openvpn/clinat.c
M src/openvpn/clinat.h
M src/openvpn/comp.c
M src/openvpn/comp.h
M src/openvpn/crypto.c
M src/openvpn/crypto.h
M src/openvpn/dco.c
M src/openvpn/dco.h
M src/openvpn/dco_freebsd.c
M src/openvpn/dco_internal.h
M src/openvpn/dco_linux.c
M src/openvpn/dco_win.c
M src/openvpn/dhcp.c
M src/openvpn/dhcp.h
M src/openvpn/event.h
M src/openvpn/forward.c
M src/openvpn/forward.h
M src/openvpn/init.c
M src/openvpn/init.h
M src/openvpn/interval.h
M src/openvpn/list.c
M src/openvpn/list.h
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/mbuf.c
M src/openvpn/mbuf.h
M src/openvpn/mss.c
M src/openvpn/mss.h
M src/openvpn/mtcp.c
M src/openvpn/mtcp.h
M src/openvpn/mudp.c
M src/openvpn/multi.c
M src/openvpn/multi.h
M src/openvpn/networking.h
M src/openvpn/networking_iproute2.c
M src/openvpn/networking_sitnl.c
M src/openvpn/occ.h
M src/openvpn/openssl_compat.h
M src/openvpn/options.c
M src/openvpn/options_parse.c
M src/openvpn/otime.c
M src/openvpn/otime.h
M src/openvpn/proto.h
M src/openvpn/proxy.c
M src/openvpn/proxy.h
M src/openvpn/ps.c
M src/openvpn/ps.h
M src/openvpn/push.c
M src/openvpn/push.h
M src/openvpn/push_util.c
M src/openvpn/reliable.c
M src/openvpn/reliable.h
M src/openvpn/route.c
M src/openvpn/schedule.c
M src/openvpn/socket.c
M src/openvpn/socket.h
M src/openvpn/socket_util.h
M src/openvpn/socks.c
M src/openvpn/socks.h
M src/openvpn/ssl.c
M src/openvpn/ssl.h
M src/openvpn/ssl_backend.h
M src/openvpn/ssl_mbedtls.c
M src/openvpn/ssl_openssl.c
M src/openvpn/ssl_pkt.c
M src/openvpn/ssl_pkt.h
M src/openvpn/ssl_verify.c
M src/openvpn/ssl_verify.h
M src/openvpn/status.c
M src/openvpn/status.h
M src/openvpn/tun.c
M src/openvpn/tun.h
M src/openvpn/tun_afunix.c
M src/openvpn/tun_afunix.h
M src/openvpn/vlan.c
M src/openvpn/vlan.h
M src/openvpn/win32.h
M src/openvpnmsica/openvpnmsica.c
M src/openvpnserv/interactive.c
M tests/unit_tests/openvpn/mock_management.c
M tests/unit_tests/openvpn/test_misc.c
M tests/unit_tests/openvpn/test_user_pass.c
88 files changed, 322 insertions(+), 282 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/63/1663/4
dev-tools/cppcheck-suppression +31 -1
@@ -2,7 +2,6 @@ # occurences right now. They still should be fixed at some point constParameter constParameterCallback -constParameterPointer invalidPrintfArgType_sint invalidPrintfArgType_uint usleepCalled
@@ -33,6 +32,37 @@ badBitmaskCheck:tests/unit_tests/openvpn/test_pkt.c # IGN: we store integers in pointers CastAddressToIntegerAtReturn:src/openvpn/multi.c +constParameterPointer:/usr/include/* +# IGN: test files provide mocks/stubs that match prototypes from headers exactly +constParameterPointer:tests/unit_tests/openvpn/mock_* +constParameterPointer:tests/unit_tests/openvpn/test_* +constParameterPointer:tests/unit_tests/openvpnserv/test_* +# FP: different crypto implementations but same API +constParameterPointer:src/openvpn/crypto_mbedtls_legacy.c:85 +constParameterPointer:src/openvpn/crypto_openssl.c:172 +constParameterPointer:src/openvpn/crypto_openssl.c:1456 +constParameterPointer:src/openvpn/cryptoapi.c:58 +constParameterPointer:src/openvpn/ssl_mbedtls.c +constParameterPointer:src/openvpn/ssl_openssl.c +constParameterPointer:src/openvpn/ssl_verify_mbedtls.c +# IGN: too many different implementations, not worth it +constParameterPointer:src/openvpn/dco* +constParameterPointer:src/openvpn/socket.* +# FP: parameters are modified on some platform only +constParameterPointer:src/openvpn/dns.c:859 +constParameterPointer:src/openvpn/error.c:223 +constParameterPointer:src/openvpn/forward.c:1247 +constParameterPointer:src/openvpn/manage.c:344 +constParameterPointer:src/openvpn/manage.c:3332 +constParameterPointer:src/openvpn/misc.c:792 +constParameterPointer:src/openvpn/misc.c:812 +constParameterPointer:src/openvpn/options.c:3205 +constParameterPointer:src/openvpn/route.c:3947 +constParameterPointer:src/openvpn/tun.c:560 +constParameterPointer:src/openvpn/tun.c:2188 +constParameterPointer:src/openvpn/tun_afunix.c +# IGN: not a FP but the documentation for the FP_ISSET claims this is not const... +constParameterPointer:src/openvpn/event.c:1015 # IGN: event code uses a pointer to store integers intToPointerCast:src/openvpn/forward.c intToPointerCast:src/openvpn/multi_io.c
sample/sample-plugins/client-connect/sample-client-connect.c +2 -2
@@ -344,7 +344,7 @@ }int -openvpn_plugin_client_connect (struct plugin_context *context,const char **argv,const char **envp) +openvpn_plugin_client_connect (const struct plugin_context *context,const char **argv,const char **envp) {/* log environment variables handed to us by OpenVPN, but * only if "setenv verb" is 3 or higher (arbitrary number)
@@ -465,7 +465,7 @@int openvpn_plugin_client_connect_defer_v2 (struct plugin_context *context, -struct plugin_per_client_context *pcc, +const struct plugin_per_client_context *pcc,struct openvpn_plugin_string_list **return_list) {time_t time_left = pcc->sleep_until -time (NULL );
sample/sample-plugins/defer/multi-auth.c +2 -2
@@ -255,7 +255,7 @@ }static bool -do_auth_user_pass (struct plugin_context *context,const char *username,const char *password) +do_auth_user_pass (const struct plugin_context *context,const char *username,const char *password) {plog (context,PLOG_NOTE ,"expect_user=%s, received_user=%s, expect_passw=%s, received_passw=%s" ,np (context->test_valid_user),np (username),np (context->test_valid_pass),np (password));
@@ -279,7 +279,7 @@static int -auth_user_pass_verify (struct plugin_context *context,struct plugin_per_client_context *pcc, +auth_user_pass_verify (const struct plugin_context *context,struct plugin_per_client_context *pcc,const char *argv[],const char *envp[]) {/* get username/password from envp string array */
sample/sample-plugins/keying-material-exporter-demo/keyingmaterialexporter.c +3 -3
@@ -186,7 +186,7 @@ }static void -file_store (char *file,char *content) +file_store (const char *file,const char *content) {FILE *f;if (!(f =fopen (file,"w+" )))
@@ -202,7 +202,7 @@ server_store(struct openvpn_plugin_args_func_in const *args) {struct plugin *plugin = (struct plugin *)args->handle; -struct session *sess = (struct session *)args->per_client_context; +const struct session *sess = (struct session *)args->per_client_context;char file[MAXPATH ];snprintf (file,sizeof (file) -1 ,"/tmp/openvpn_sso_%s" , sess->key);
@@ -214,7 +214,7 @@ client_store(struct openvpn_plugin_args_func_in const *args) {struct plugin *plugin = (struct plugin *)args->handle; -struct session *sess = (struct session *)args->per_client_context; +const struct session *sess = (struct session *)args->per_client_context;char *file ="/tmp/openvpn_sso_user" ;ovpn_note ("app session file: %s" , file);
src/openvpn/buffer.c +2 -2
@@ -290,7 +290,7 @@* truncated by buf_printf */ void -buf_catrunc (struct buffer *buf,const char *str) +buf_catrunc (const struct buffer *buf,const char *str) {if (buf_forward_capacity (buf) <=1 ) {
@@ -1091,7 +1091,7 @@ }bool -string_check_buf (struct buffer *buf,const unsigned int inclusive,const unsigned int exclusive) +string_check_buf (const struct buffer *buf,const unsigned int inclusive,const unsigned int exclusive) {ASSERT (buf);
src/openvpn/buffer.h +4 -4
@@ -487,7 +487,7 @@* write a string to the end of a buffer that was * truncated by buf_printf */ -void buf_catrunc (struct buffer *buf,const char *str); +void buf_catrunc (const struct buffer *buf,const char *str);/* * Parse a string based on a given delimiter char
@@ -774,7 +774,7 @@ }static inline int -buf_peek_u8 (struct buffer *buf) +buf_peek_u8 (const struct buffer *buf) {int ret;if (BLEN (buf) <1 )
@@ -923,7 +923,7 @@* @param exclusive Character classes that are not allowed even if they are also in inclusive. * @return True if the string consists only of allowed characters, false otherwise. */ -bool string_check_buf (struct buffer *buf,const unsigned int inclusive, +bool string_check_buf (const struct buffer *buf,const unsigned int inclusive,const unsigned int exclusive);/**
@@ -1102,7 +1102,7 @@ }static inline void -check_malloc_return (void *p) +check_malloc_return (const void *p) {if (!p) {
src/openvpn/clinat.c +2 -2
@@ -159,7 +159,7 @@#endif static void -print_pkt (struct openvpn_iphdr *iph,const char *prefix,const int direction,const msglvl_t msglevel) +print_pkt (const struct openvpn_iphdr *iph,const char *prefix,const int direction,const msglvl_t msglevel) {struct gc_arena gc =gc_new ();
@@ -181,7 +181,7 @@ }void -client_nat_transform (const struct client_nat_option_list *list,struct buffer *ipbuf, +client_nat_transform (const struct client_nat_option_list *list,const struct buffer *ipbuf,const int direction) {struct ip_tcp_udp_hdr *h = (struct ip_tcp_udp_hdr *)BPTR (ipbuf);
src/openvpn/clinat.h +1 -1
@@ -60,7 +60,7 @@ const char *network, const char *netmask, const char *foreign_network, msglvl_t msglevel); -void client_nat_transform (const struct client_nat_option_list *list,struct buffer *ipbuf, +void client_nat_transform (const struct client_nat_option_list *list,const struct buffer *ipbuf,const int direction);#endif /* if !defined(CLINAT_H) */
src/openvpn/comp.c +1 -1
@@ -159,7 +159,7 @@#endif /* USE_COMP */ bool -check_compression_settings_valid (struct compress_options *info,msglvl_t msglevel) +check_compression_settings_valid (const struct compress_options *info,msglvl_t msglevel) {/* * We also allow comp-stub-v2 here as it technically allows escaping of
src/openvpn/comp.h +1 -1
@@ -91,7 +91,7 @@* flags of allow-compression and also the whether algorithms are compiled * in */ -bool check_compression_settings_valid (struct compress_options *info,msglvl_t msglevel); +bool check_compression_settings_valid (const struct compress_options *info,msglvl_t msglevel);#ifdef USE_COMP #include "buffer.h"
src/openvpn/crypto.c +3 -3
@@ -1105,7 +1105,7 @@ }static bool -key_is_zero (struct key *key,const struct key_type *kt) +key_is_zero (const struct key *key,const struct key_type *kt) {size_t cipher_length =cipher_kt_key_size (kt->cipher);for (size_t i =0 ; i < cipher_length; ++i)
@@ -1123,7 +1123,7 @@* Make sure that cipher key is a valid key for current key_type. */ bool -check_key (struct key *key,const struct key_type *kt) +check_key (const struct key *key,const struct key_type *kt) {if (cipher_defined (kt->cipher)) {
@@ -1196,7 +1196,7 @@ }void -test_crypto (struct crypto_options *co,struct frame *frame) +test_crypto (struct crypto_options *co,const struct frame *frame) {int i, j;struct gc_arena gc =gc_new ();
src/openvpn/crypto.h +2 -2
@@ -414,7 +414,7 @@*/ int write_key_file (const int nkeys,const char *filename); -bool check_key (struct key *key,const struct key_type *kt); +bool check_key (const struct key *key,const struct key_type *kt);/** * Initialize a key_type structure with.
@@ -609,7 +609,7 @@/** Print a cipher list entry */ void print_cipher (const char *cipher); -void test_crypto (struct crypto_options *co,struct frame *f); +void test_crypto (struct crypto_options *co,const struct frame *f);/* key direction functions */
src/openvpn/dco.c +5 -5
@@ -556,7 +556,7 @@ }static bool -dco_multi_get_localaddr (struct multi_context *m,struct multi_instance *mi, +dco_multi_get_localaddr (const struct multi_context *m,const struct multi_instance *mi,struct sockaddr_storage *local) {#if ENABLE_IP_PKTINFO
@@ -568,7 +568,7 @@return false; } -struct link_socket_actual *actual = &c->c2.link_socket_infos[0 ]->lsa->actual; +const struct link_socket_actual *actual = &c->c2.link_socket_infos[0 ]->lsa->actual;switch (actual->dest.addr.sa.sa_family) {
@@ -606,7 +606,7 @@ }int -dco_multi_add_new_peer (struct multi_context *m,struct multi_instance *mi) +dco_multi_add_new_peer (const struct multi_context *m,struct multi_instance *mi) {const struct context *c = &mi->context;
@@ -660,7 +660,7 @@ }void -dco_install_iroute (struct multi_context *m,struct multi_instance *mi,struct mroute_addr *addr) +dco_install_iroute (struct multi_context *m,struct multi_instance *mi,const struct mroute_addr *addr) {#if defined(TARGET_LINUX ) || defined(TARGET_FREEBSD ) || defined(_WIN32)if (!dco_enabled (&m->top.options))
@@ -779,7 +779,7 @@/* Checked if we added a host route as the assigned client IP address was * outside the --ifconfig-ipv6 tun interface config */ #if !defined(_WIN32) -struct in6_addr *dest = &mi->context.c2.push_ifconfig_ipv6_local; +const struct in6_addr *dest = &mi->context.c2.push_ifconfig_ipv6_local;if (multi_check_push_ifconfig_ipv6_extra_route (mi, dest)) {/* On windows we do not install these routes, so we also do not need to delete them */
src/openvpn/dco.h +5 -5
@@ -204,7 +204,7 @@* @param mi the client instance * @return 0 on success or a negative error code otherwise */ -int dco_multi_add_new_peer (struct multi_context *m,struct multi_instance *mi); +int dco_multi_add_new_peer (const struct multi_context *m,struct multi_instance *mi);/** * Install an iroute in DCO, which means adding a route to the system routing
@@ -215,7 +215,7 @@* @param addr the route to add */ void dco_install_iroute (struct multi_context *m,struct multi_instance *mi, -struct mroute_addr *addr); +const struct mroute_addr *addr);/** * Remove all routes added through the specified client
@@ -253,7 +253,7 @@* a 64 bit packet counter and AEAD tag at the end. */ bool -dco_supports_epoch_data (struct context *c); +dco_supports_epoch_data (const struct context *c);#else /* if defined(ENABLE_DCO) */ typedef void *dco_context_t ;
@@ -350,7 +350,7 @@ }static inline int -dco_multi_add_new_peer (struct multi_context *m,struct multi_instance *mi) +dco_multi_add_new_peer (const struct multi_context *m,struct multi_instance *mi) {return 0 ; }
@@ -384,7 +384,7 @@ }static inline bool -dco_supports_epoch_data (struct context *c) +dco_supports_epoch_data (const struct context *c) {return false; }
src/openvpn/dco_freebsd.c +1 -1
@@ -930,7 +930,7 @@ }bool -dco_supports_epoch_data (struct context *c) +dco_supports_epoch_data (const struct context *c) {return false; }
src/openvpn/dco_internal.h +3 -2
@@ -59,8 +59,9 @@* They are implemented by dco_linux.c */ -int dco_new_peer (dco_context_t *dco,unsigned int peerid,socket_descriptor_t sd,struct sockaddr *localaddr, -struct sockaddr *remoteaddr,const struct in_addr *vpn_ipv4,const struct in6_addr *vpn_ipv6); +int dco_new_peer (dco_context_t *dco,unsigned int peerid,socket_descriptor_t sd, +struct sockaddr *localaddr,struct sockaddr *remoteaddr, +const struct in_addr *vpn_ipv4,const struct in6_addr *vpn_ipv6);int dco_del_peer (dco_context_t *dco,unsigned int peerid);
src/openvpn/dco_linux.c +4 -4
@@ -114,7 +114,7 @@ }static struct nl_msg * -ovpn_dco_nlmsg_create (dco_context_t *dco,uint8_t cmd) +ovpn_dco_nlmsg_create (const dco_context_t *dco,uint8_t cmd) {struct nl_msg *nl_msg =nlmsg_alloc ();if (!nl_msg)
@@ -804,7 +804,7 @@/* libnl < 3.11.0 does not implement nla_get_uint() */ static uint64_t -ovpn_nla_get_uint (struct nlattr *attr) +ovpn_nla_get_uint (const struct nlattr *attr) {if (nla_len (attr) ==sizeof (uint32_t )) {
@@ -916,7 +916,7 @@ }static bool -ovpn_iface_check (dco_context_t *dco,struct nlattr *attrs[]) +ovpn_iface_check (const dco_context_t *dco,struct nlattr *attrs[]) {/* we must know which interface this message is referring to in order to * avoid mixing messages for other instances
@@ -1340,7 +1340,7 @@ }bool -dco_supports_epoch_data (struct context *c) +dco_supports_epoch_data (const struct context *c) {return false; }
src/openvpn/dco_win.c +1 -1
@@ -1100,7 +1100,7 @@ }bool -dco_supports_epoch_data (struct context *c) +dco_supports_epoch_data (const struct context *c) {OVPN_VERSION ver = {0 };return dco_get_version (&ver) && ((ver.Major ==2 && ver.Minor >=8 ) || (ver.Major >2 ));
src/openvpn/dhcp.c +1 -1
@@ -145,7 +145,7 @@ }in_addr_t -dhcp_extract_router_msg (struct buffer *ipbuf) +dhcp_extract_router_msg (const struct buffer *ipbuf) {struct dhcp_full *df = (struct dhcp_full *)BPTR (ipbuf); const int optlen =
src/openvpn/dhcp.h +1 -1
@@ -91,7 +91,7 @@#pragma pack() -in_addr_t dhcp_extract_router_msg (struct buffer *ipbuf); +in_addr_t dhcp_extract_router_msg (const struct buffer *ipbuf);#if defined(_WIN32) || defined(DHCP_UNIT_TEST )#include "tun.h"
src/openvpn/event.h +1 -1
@@ -204,7 +204,7 @@#else /* ifdef _WIN32 */ static inline void -wait_signal (struct event_set *es,void *arg) +wait_signal (const struct event_set *es,const void *arg) { }
src/openvpn/forward.c +6 -6
@@ -231,7 +231,7 @@ }static void -parse_incoming_control_channel_command (struct context *c,struct buffer *buf) +parse_incoming_control_channel_command (struct context *c,const struct buffer *buf) {if (buf_string_match_head_str (buf,"AUTH_FAILED" )) {
@@ -501,7 +501,7 @@ }int -get_server_poll_remaining_time (struct event_timeout *server_poll_timeout) +get_server_poll_remaining_time (const struct event_timeout *server_poll_timeout) {update_time ();int remaining =event_timeout_remaining (server_poll_timeout);
@@ -598,7 +598,7 @@* Buffer reallocation, for use with null encryption. */ static inline void -buffer_turnover (const uint8_t *orig_buf,struct buffer *dest_stub,struct buffer *src_stub, +buffer_turnover (const uint8_t *orig_buf,struct buffer *dest_stub,const struct buffer *src_stub,struct buffer *storage) {if (orig_buf == src_stub->data && src_stub->data != storage->data)
@@ -885,7 +885,7 @@*/ static inline void -socks_postprocess_incoming_link (struct context *c,struct link_socket *sock) +socks_postprocess_incoming_link (struct context *c,const struct link_socket *sock) {if (sock->socks_proxy && sock->info.proto ==PROTO_UDP ) {
@@ -984,7 +984,7 @@ }bool -process_incoming_link_part1 (struct context *c,struct link_socket_info *lsi,bool floated) +process_incoming_link_part1 (struct context *c,const struct link_socket_info *lsi,bool floated) {struct gc_arena gc =gc_new ();bool decrypt_status = false;
@@ -1534,7 +1534,7 @@* @param client Determines whether to the send packet back via tun or link */ void -ipv6_send_icmp_unreachable (struct context *c,struct buffer *buf,bool client) +ipv6_send_icmp_unreachable (struct context *c,const struct buffer *buf,bool client) {#define MAX_ICMPV6LEN 1280struct openvpn_icmp6hdr icmp6out;
src/openvpn/forward.h +2 -2
@@ -112,7 +112,7 @@*/ void encrypt_sign (struct context *c,bool comp_frag); -int get_server_poll_remaining_time (struct event_timeout *server_poll_timeout); +int get_server_poll_remaining_time (const struct event_timeout *server_poll_timeout);/**********************************************************************/ /**
@@ -163,7 +163,7 @@* * @return true if packet is authenticated, false otherwise. */ -bool process_incoming_link_part1 (struct context *c,struct link_socket_info *lsi,bool floated); +bool process_incoming_link_part1 (struct context *c,const struct link_socket_info *lsi,bool floated);/** * Continues processing a packet read from the external network interface.
src/openvpn/init.c +5 -5
@@ -817,7 +817,7 @@ }static void -init_port_share (struct context *c) +init_port_share (const struct context *c) {if (!port_share && (c->options.port_share_host && c->options.port_share_port)) {
@@ -1269,7 +1269,7 @@* prepending to msg() output. */ const char * -format_common_name (struct context *c,struct gc_arena *gc) +format_common_name (const struct context *c,struct gc_arena *gc) {struct buffer out =alloc_buf_gc (256 , gc);if (c->c2.tls_multi)
@@ -1755,7 +1755,7 @@static bool -can_preserve_tun (struct tuntap *tt) +can_preserve_tun (const struct tuntap *tt) {if (tt && tt->backend_driver ==DRIVER_AFUNIX ) {
@@ -1777,7 +1777,7 @@* @param c pointer to the connection context */ static void -add_wfp_block (struct context *c) +add_wfp_block (const struct context *c) {#if defined(_WIN32)/* Fortify 'redirect-gateway block-local' with firewall rules? */
@@ -1803,7 +1803,7 @@* @param adapter_index the VPN adapter index */ static void -del_wfp_block (struct context *c,unsigned long adapter_index) +del_wfp_block (const struct context *c,unsigned long adapter_index) {#if defined(_WIN32)if (c->options.block_outside_dns ||block_local_needed (c->c1.route_list))
src/openvpn/init.h +1 -1
@@ -91,7 +91,7 @@unsigned int pull_permission_mask (const struct context *c); -const char *format_common_name (struct context *c,struct gc_arena *gc); +const char *format_common_name (const struct context *c,struct gc_arena *gc);void reset_coarse_timers (struct context *c);
src/openvpn/interval.h +2 -2
@@ -89,7 +89,7 @@ }static inline void -interval_schedule_wakeup (struct interval *top,interval_t *wakeup) +interval_schedule_wakeup (const struct interval *top,interval_t *wakeup) {const time_t local_now = now;interval_earliest_wakeup (wakeup, top->last_test_true + top->refresh, local_now);
@@ -214,7 +214,7 @@* This function does not check if the timeout is actually valid. */ static inline interval_t -event_timeout_remaining (struct event_timeout *et) +event_timeout_remaining (const struct event_timeout *et) {return (interval_t)((et->last + et->n) - now); }
src/openvpn/list.c +1 -1
@@ -162,7 +162,7 @@ }void -hash_remove_by_value (struct hash *hash,void *value) +hash_remove_by_value (struct hash *hash,const void *value) {struct hash_iterator hi;const struct hash_element *he;
src/openvpn/list.h +1 -1
@@ -73,7 +73,7 @@bool hash_remove_fast (struct hash *hash,struct hash_bucket *bucket,const void *key,uint32_t hv); -void hash_remove_by_value (struct hash *hash,void *value); +void hash_remove_by_value (struct hash *hash,const void *value);struct hash_iterator {
src/openvpn/manage.c +14 -13
@@ -330,7 +330,7 @@ }static void -man_delete_unix_socket (struct management *man) +man_delete_unix_socket (const struct management *man) {#if UNIX_SOCK_SUPPORT if ((man->settings.flags & (MF_UNIX_SOCK |MF_CONNECT_AS_CLIENT )) ==MF_UNIX_SOCK )
@@ -675,7 +675,7 @@* for the log and echo commands. */ static void -man_history (struct management *man,const char *parm,const char *type,struct log_history *log, +man_history (struct management *man,const char *parm,const char *type,const struct log_history *log,bool *realtime,const unsigned int lep_flags) {struct gc_arena gc =gc_new ();
@@ -843,7 +843,7 @@ }static void -man_forget_passwords (struct management *man) +man_forget_passwords (const struct management *man) {ssl_purge_auth (false); (void )ssl_clean_auth_token ();
@@ -851,7 +851,7 @@ }static void -man_net (struct management *man) +man_net (const struct management *man) {if (man->persist.callback.show_net) {
@@ -887,7 +887,7 @@#ifdef ENABLE_PKCS11 static void -man_pkcs11_id_count (struct management *man) +man_pkcs11_id_count (const struct management *man) {msg (M_CLIENT ,">PKCS11ID-COUNT:%d" ,pkcs11_management_id_count ()); }
@@ -1350,7 +1350,7 @@* @return Return whether p has n (or at least n) parameters */ static bool -man_need (struct management *man,const char **p,const int n,unsigned int flags) +man_need (const struct management *man,const char **p,const int n,unsigned int flags) {int i;ASSERT (p[0 ]);
@@ -2365,7 +2365,7 @@* the route/ifconfig/open tun command. See doc/android.txt for details. */ bool -management_android_control (struct management *man,const char *command,const char *msg) +management_android_control (const struct management *man,const char *command,const char *msg) {if (!man) {
@@ -3013,7 +3013,7 @@ }void -management_up_down (struct management *man,const char *updown,const struct env_set *es) +management_up_down (const struct management *man,const char *updown,const struct env_set *es) {if (man->settings.flags &MF_UP_DOWN ) {
@@ -3023,13 +3023,13 @@ }void -management_notify (struct management *man,const char *severity,const char *type,const char *text) +management_notify (const struct management *man,const char *severity,const char *type,const char *text) {msg (M_CLIENT ,">NOTIFY:%s,%s,%s" , severity, type, text); }void -management_notify_generic (struct management *man,const char *str) +management_notify_generic (const struct management *man,const char *str) {msg (M_CLIENT ,"%s" , str); }
@@ -3115,7 +3115,8 @@ }void -management_notify_client_close (struct management *management,struct man_def_auth_context *mdac, +management_notify_client_close (const struct management *management, +struct man_def_auth_context *mdac,const struct env_set *es) {if ((mdac->flags &DAF_INITIAL_AUTH ) && !(mdac->flags &DAF_CONNECTION_CLOSED ))
@@ -3206,7 +3207,7 @@ }void -management_auth_failure (struct management *man,const char *type,const char *reason) +management_auth_failure (const struct management *man,const char *type,const char *reason) {if (reason) {
@@ -3219,7 +3220,7 @@ }void -management_auth_token (struct management *man,const char *token) +management_auth_token (const struct management *man,const char *token) {msg (M_CLIENT ,">PASSWORD:Auth-Token:%s" , token); }
src/openvpn/manage.h +6 -6
@@ -376,12 +376,12 @@void management_event_loop_n_seconds (struct management *man,int sec); -void management_up_down (struct management *man,const char *updown,const struct env_set *es); +void management_up_down (const struct management *man,const char *updown,const struct env_set *es); -void management_notify (struct management *man,const char *severity,const char *type, +void management_notify (const struct management *man,const char *severity,const char *type,const char *text); -void management_notify_generic (struct management *man,const char *str); +void management_notify_generic (const struct management *man,const char *str); void management_notify_client_needing_auth(struct management *management, const unsigned int auth_id,
@@ -391,7 +391,7 @@void management_connection_established (struct management *management,struct man_def_auth_context *mdac,const struct env_set *es); -void management_notify_client_close (struct management *management, +void management_notify_client_close (const struct management *management,struct man_def_auth_context *mdac,const struct env_set *es); void management_learn_addr(struct management *management, struct man_def_auth_context *mdac,
@@ -476,12 +476,12 @@* OpenVPN calls here to indicate a password failure */ -void management_auth_failure (struct management *man,const char *type,const char *reason); +void management_auth_failure (const struct management *man,const char *type,const char *reason);/* * Echo an authentication token to management interface */ -void management_auth_token (struct management *man,const char *token); +void management_auth_token (const struct management *man,const char *token);/* * These functions drive the bytecount in/out counters.
src/openvpn/mbuf.c +1 -1
@@ -160,7 +160,7 @@ }void -mbuf_dereference_instance (struct mbuf_set *ms,struct multi_instance *mi) +mbuf_dereference_instance (struct mbuf_set *ms,const struct multi_instance *mi) {if (ms) {
src/openvpn/mbuf.h +1 -1
@@ -75,7 +75,7 @@bool mbuf_extract_item (struct mbuf_set *ms,struct mbuf_item *item); -void mbuf_dereference_instance (struct mbuf_set *ms,struct multi_instance *mi); +void mbuf_dereference_instance (struct mbuf_set *ms,const struct multi_instance *mi);static inline bool mbuf_defined (const struct mbuf_set *ms)
src/openvpn/mss.c +9 -9
@@ -43,7 +43,7 @@* if yes, hand to mss_fixup_dowork() */ void -mss_fixup_ipv4 (struct buffer *buf,uint16_t maxmss) +mss_fixup_ipv4 (const struct buffer *buf,uint16_t maxmss) {const struct openvpn_iphdr *pip;int hlen;
@@ -80,7 +80,7 @@* (IPv6 header structure is sufficiently different from IPv4...) */ void -mss_fixup_ipv6 (struct buffer *buf,uint16_t maxmss) +mss_fixup_ipv6 (const struct buffer *buf,uint16_t maxmss) {const struct openvpn_ipv6hdr *pip6;struct buffer newbuf;
@@ -136,7 +136,7 @@*/ void -mss_fixup_dowork (struct buffer *buf,uint16_t maxmss) +mss_fixup_dowork (const struct buffer *buf,uint16_t maxmss) {int olen, optlen;uint8_t *opt;
@@ -239,8 +239,8 @@ }static void -frame_calculate_fragment (struct frame *frame,struct key_type *kt,const struct options *options, -struct link_socket_info *lsi) +frame_calculate_fragment (struct frame *frame,const struct key_type *kt,const struct options *options, +const struct link_socket_info *lsi) {#if defined(ENABLE_FRAGMENT )size_t overhead;
@@ -269,8 +269,8 @@ }static void -frame_calculate_mssfix (struct frame *frame,struct key_type *kt,const struct options *options, -struct link_socket_info *lsi) +frame_calculate_mssfix (struct frame *frame,const struct key_type *kt,const struct options *options, +const struct link_socket_info *lsi) {if (options->ce.mssfix_fixed) {
@@ -314,8 +314,8 @@ }void -frame_calculate_dynamic (struct frame *frame,struct key_type *kt,const struct options *options, -struct link_socket_info *lsi) +frame_calculate_dynamic (struct frame *frame,const struct key_type *kt,const struct options *options, +const struct link_socket_info *lsi) {if (options->ce.fragment >0 ) {
src/openvpn/mss.h +5 -5
@@ -29,15 +29,15 @@#include "socket.h" #include "ssl_common.h" -void mss_fixup_ipv4 (struct buffer *buf,uint16_t maxmss); +void mss_fixup_ipv4 (const struct buffer *buf,uint16_t maxmss); -void mss_fixup_ipv6 (struct buffer *buf,uint16_t maxmss); +void mss_fixup_ipv6 (const struct buffer *buf,uint16_t maxmss); -void mss_fixup_dowork (struct buffer *buf,uint16_t maxmss); +void mss_fixup_dowork (const struct buffer *buf,uint16_t maxmss);/** Set the --mssfix option. */ -void frame_calculate_dynamic (struct frame *frame,struct key_type *kt, -const struct options *options,struct link_socket_info *lsi); +void frame_calculate_dynamic (struct frame *frame,const struct key_type *kt, +const struct options *options,const struct link_socket_info *lsi);/** * Checks and adjusts the fragment and mssfix value according to the
src/openvpn/mtcp.c +1 -1
@@ -91,7 +91,7 @@ }bool -multi_tcp_instance_specific_init (struct multi_context *m,struct multi_instance *mi) +multi_tcp_instance_specific_init (const struct multi_context *m,struct multi_instance *mi) {/* buffer for queued TCP socket output packets */ mi->tcp_link_out_deferred =mbuf_init (m->top.options.n_bcast_buf);
src/openvpn/mtcp.h +1 -1
@@ -35,7 +35,7 @@void multi_tcp_dereference_instance (struct multi_io *multi_io,struct multi_instance *mi); -bool multi_tcp_instance_specific_init (struct multi_context *m,struct multi_instance *mi); +bool multi_tcp_instance_specific_init (const struct multi_context *m,struct multi_instance *mi);void multi_tcp_instance_specific_free (struct multi_instance *mi);
src/openvpn/mudp.c +2 -2
@@ -39,7 +39,7 @@static void send_hmac_reset_packet (struct multi_context *m,struct tls_pre_decrypt_state *state, -struct tls_auth_standalone *tas,struct session_id *sid, +const struct tls_auth_standalone *tas,const struct session_id *sid,bool request_resend_wkc) {reset_packet_id_send (&state->tls_wrap_tmp.opt.packet_id.send);
@@ -69,7 +69,7 @@enum first_packet_verdict verdict; -struct tls_auth_standalone *tas = m->top.c2.tls_auth_standalone; +const struct tls_auth_standalone *tas = m->top.c2.tls_auth_standalone; verdict =tls_pre_decrypt_lite (tas, state, &m->top.c2.from, &m->top.c2.buf);
src/openvpn/multi.c +8 -8
@@ -57,7 +57,7 @@#ifdef MULTI_DEBUG_EVENT_LOOP static const char * -id (struct multi_instance *mi) +id (const struct multi_instance *mi) {if (mi) {
@@ -1315,7 +1315,7 @@* same common name. */ static void -multi_delete_dup (struct multi_context *m,struct multi_instance *new_mi) +multi_delete_dup (struct multi_context *m,const struct multi_instance *new_mi) {if (new_mi) {
@@ -2260,7 +2260,7 @@ }static bool -multi_client_setup_dco_initial (struct multi_context *m,struct multi_instance *mi, +multi_client_setup_dco_initial (const struct multi_context *m,struct multi_instance *mi,struct gc_arena *gc) {if (!dco_enabled (&mi->context.options))
@@ -3195,7 +3195,7 @@#if defined(ENABLE_DCO )static void -process_incoming_del_peer (struct multi_context *m,struct multi_instance *mi,dco_context_t *dco) +process_incoming_del_peer (struct multi_context *m,struct multi_instance *mi,const dco_context_t *dco) {const char *reason ="ovpn-dco: unknown reason" ; switch (dco->dco_del_peer_reason)
@@ -4226,7 +4226,7 @@/* Searches for the address and deletes it if it is owned by the multi_instance */ static void -multi_unlearn_addr (struct multi_context *m,struct multi_instance *mi,const struct mroute_addr *addr) +multi_unlearn_addr (struct multi_context *m,const struct multi_instance *mi,const struct mroute_addr *addr) {struct hash_element *he;const uint32_t hv =hash_value (m->vhash, addr);
@@ -4261,7 +4261,7 @@* @param a The new IPv4 address in network byte order */ static void -multi_unlearn_in_addr_t (struct multi_context *m,struct multi_instance *mi,in_addr_t a) +multi_unlearn_in_addr_t (struct multi_context *m,const struct multi_instance *mi,in_addr_t a) {struct mroute_addr addr;CLEAR (addr);
@@ -4279,7 +4279,7 @@* @param a6 The new IPv6 address */ static void -multi_unlearn_in6_addr (struct multi_context *m,struct multi_instance *mi,struct in6_addr a6) +multi_unlearn_in6_addr (struct multi_context *m,const struct multi_instance *mi,struct in6_addr a6) {struct mroute_addr addr;CLEAR (addr);
@@ -4395,7 +4395,7 @@bool multi_check_push_ifconfig_ipv6_extra_route (struct multi_instance *mi, -struct in6_addr *dest) +const struct in6_addr *dest) {const struct options *o = &mi->context.options;
src/openvpn/multi.h +2 -2
@@ -520,7 +520,7 @@*/ static inline void -set_prefix (struct multi_instance *mi) +set_prefix (const struct multi_instance *mi) {#ifdef MULTI_DEBUG_EVENT_LOOP if (mi->msg_prefix[0 ])
@@ -694,7 +694,7 @@*/ bool multi_check_push_ifconfig_ipv6_extra_route (struct multi_instance *mi, -struct in6_addr *dest); +const struct in6_addr *dest);/* * Check for signals.
src/openvpn/networking.h +3 -3
@@ -44,7 +44,7 @@*/ #if !defined(ENABLE_IPROUTE )static inline int -net_ctx_init (struct context *c,openvpn_net_ctx_t *ctx) +net_ctx_init (const struct context *c,openvpn_net_ctx_t *ctx) { (void )c; (void )ctx;
@@ -75,7 +75,7 @@* * @return 0 on success, a negative error code otherwise */ -int net_ctx_init (struct context *c,openvpn_net_ctx_t *ctx); +int net_ctx_init (const struct context *c,openvpn_net_ctx_t *ctx);/** * Release resources allocated by the internal garbage collector
@@ -102,7 +102,7 @@* @return 0 on success, negative error code on error */ int net_iface_new (openvpn_net_ctx_t *ctx,const openvpn_net_iface_t *iface,const char *type, -void *arg); +const void *arg);/** * Retrieve the interface type
src/openvpn/networking_iproute2.c +2 -2
@@ -36,7 +36,7 @@#include <netinet/in.h> int -net_ctx_init (struct context *c,openvpn_net_ctx_t *ctx) +net_ctx_init (const struct context *c,openvpn_net_ctx_t *ctx) { ctx->es =NULL ;if (c)
@@ -61,7 +61,7 @@ }int -net_iface_new (openvpn_net_ctx_t *ctx,const char *iface,const char *type,void *arg) +net_iface_new (openvpn_net_ctx_t *ctx,const char *iface,const char *type,const void *arg) {struct argv argv =argv_new ();
src/openvpn/networking_sitnl.c +4 -4
@@ -987,7 +987,7 @@ }static int -sitnl_addr_del (sa_family_t af_family,const char *iface,inet_address_t *addr,int prefixlen) +sitnl_addr_del (sa_family_t af_family,const char *iface,const inet_address_t *addr,int prefixlen) {int ifindex;
@@ -1230,8 +1230,8 @@ }static int -sitnl_route_del (const char *iface,sa_family_t af_family,inet_address_t *dst,int prefixlen, -inet_address_t *gw,uint32_t table,int metric) +sitnl_route_del (const char *iface,sa_family_t af_family,const inet_address_t *dst,int prefixlen, +const inet_address_t *gw,uint32_t table,int metric) {int ifindex =0 ;
@@ -1308,7 +1308,7 @@int -net_iface_new (openvpn_net_ctx_t *ctx,const char *iface,const char *type,void *arg) +net_iface_new (openvpn_net_ctx_t *ctx,const char *iface,const char *type,const void *arg) {struct sitnl_link_req req = {};int ret =-1 ;
src/openvpn/occ.h +1 -1
@@ -156,7 +156,7 @@* via control channel. * @return control channel exit message should be used */ static inline bool -cc_exit_notify_enabled (struct context *c) +cc_exit_notify_enabled (const struct context *c) {/* Check if we have TLS active at all */ if (!c->c2.tls_multi)
src/openvpn/openssl_compat.h +2 -2
@@ -124,7 +124,7 @@/* Mimics the functions but only when the default context without * options is chosen */ static inline const EVP_CIPHER * -EVP_CIPHER_fetch (void *ctx,const char *algorithm,const char *properties) +EVP_CIPHER_fetch (const void *ctx,const char *algorithm,const char *properties) {ASSERT (!ctx);ASSERT (!properties);
@@ -132,7 +132,7 @@ }static inline const EVP_MD * -EVP_MD_fetch (void *ctx,const char *algorithm,const char *properties) +EVP_MD_fetch (const void *ctx,const char *algorithm,const char *properties) {ASSERT (!ctx);ASSERT (!properties);
src/openvpn/options.c +3 -3
@@ -3050,7 +3050,7 @@ }static void -options_postprocess_mutate_le (struct connection_entry *ce,struct local_entry *le,int mode) +options_postprocess_mutate_le (const struct connection_entry *ce,struct local_entry *le,int mode) {/* use the global port if none is specified */ if (!le->port)
@@ -4980,7 +4980,7 @@static bool verify_permission (const char *name,const char *file,int line,const uint64_t type,const uint64_t allowed,uint64_t *found,const msglvl_t msglevel, -struct options *options,bool is_inline) +const struct options *options,bool is_inline) {if (!(type & allowed)) {
@@ -5547,7 +5547,7 @@ }static void -show_compression_warning (struct compress_options *info) +show_compression_warning (const struct compress_options *info) {if (comp_non_stub_enabled (info)) {
src/openvpn/options_parse.c +2 -2
@@ -258,7 +258,7 @@ }static char * -read_inline_file (struct in_src *is,const char *close_tag,int *num_lines,struct gc_arena *gc) +read_inline_file (const struct in_src *is,const char *close_tag,int *num_lines,struct gc_arena *gc) {char line[OPTION_LINE_SIZE ];struct buffer buf =alloc_buf (8 *OPTION_LINE_SIZE );
@@ -302,7 +302,7 @@ }static int -check_inline_file (struct in_src *is,char *p[],struct gc_arena *gc) +check_inline_file (const struct in_src *is,char *p[],struct gc_arena *gc) {int num_inline_lines =0 ;
src/openvpn/otime.c +1 -1
@@ -66,7 +66,7 @@ }void -update_now_usec (struct timeval *tv) +update_now_usec (const struct timeval *tv) {const time_t last = now;update_now (tv->tv_sec);
src/openvpn/otime.h +1 -1
@@ -65,7 +65,7 @@void update_now (const time_t system_time);extern time_t now_usec; -void update_now_usec (struct timeval *tv); +void update_now_usec (const struct timeval *tv);static inline int openvpn_gettimeofday (struct timeval *tv,void *tz)
src/openvpn/proto.h +1 -1
@@ -248,7 +248,7 @@* and offset of IP header (via parameter). */ static inline int -get_tun_ip_ver (int tunnel_type,struct buffer *buf,int *ip_hdr_offset) +get_tun_ip_ver (int tunnel_type,const struct buffer *buf,int *ip_hdr_offset) {int ip_ver =-1 ;
src/openvpn/proxy.c +5 -4
@@ -527,8 +527,9 @@ }static bool -add_proxy_headers (struct http_proxy_info *p,socket_descriptor_t sd,/* already open to proxy */ -const char *host/* openvpn server remote */ +add_proxy_headers (const struct http_proxy_info *p, +socket_descriptor_t sd,/* already open to proxy */ +const char *host/* openvpn server remote */ ) {char buf[512 ];
@@ -597,8 +598,8 @@socket_descriptor_t sd,/* already open to proxy */ const char *host, /* openvpn server remote */ const char *port, /* openvpn server port */ - struct event_timeout *server_poll_timeout, struct buffer *lookahead, - struct signal_info *sig_info) + const struct event_timeout *server_poll_timeout, + struct buffer *lookahead, struct signal_info *sig_info) { struct gc_arena gc = gc_new();char buf[512 ];
src/openvpn/proxy.h +1 -1
@@ -89,7 +89,7 @@socket_descriptor_t sd,/* already open to proxy */ const char *host, /* openvpn server remote */ const char *port, /* openvpn server port */ - struct event_timeout *server_poll_timeout, + const struct event_timeout *server_poll_timeout, struct buffer *lookahead, struct signal_info *sig_info);uint8_t *make_base64_string2 (const uint8_t *str,int str_len,struct gc_arena *gc);
src/openvpn/ps.c +3 -3
@@ -332,7 +332,7 @@* the proxy can determine true client origin. */ static void -journal_add (const char *journal_dir,struct proxy_connection *pc,struct proxy_connection *cp) +journal_add (const char *journal_dir,const struct proxy_connection *pc,struct proxy_connection *cp) {struct openvpn_sockaddr from, to;
@@ -410,7 +410,7 @@static bool proxy_entry_new (struct proxy_connection **list,struct event_set *es,const struct openvpn_sockaddr server_addr,const socket_descriptor_t sd_client, -struct buffer *initial_data,const char *journal_dir) +const struct buffer *initial_data,const char *journal_dir) {socket_descriptor_t sd_server;int status;
@@ -1013,7 +1013,7 @@* call. */ void -port_share_redirect (struct port_share *ps,const struct buffer *head,socket_descriptor_t sd) +port_share_redirect (const struct port_share *ps,const struct buffer *head,socket_descriptor_t sd) {if (ps) {
src/openvpn/ps.h +1 -1
@@ -49,7 +49,7 @@bool is_openvpn_protocol (const struct buffer *buf); -void port_share_redirect (struct port_share *ps,const struct buffer *head,socket_descriptor_t sd); +void port_share_redirect (const struct port_share *ps,const struct buffer *head,socket_descriptor_t sd);#endif /* if PORT_SHARE */ #endif /* ifndef PS_H */
src/openvpn/push.c +1 -1
@@ -435,7 +435,7 @@#endif bool -send_auth_pending_messages (struct tls_multi *tls_multi,struct tls_session *session, +send_auth_pending_messages (const struct tls_multi *tls_multi,struct tls_session *session,const char *extra,unsigned int timeout) {struct key_state *ks = &session->key[KS_PRIMARY ];
src/openvpn/push.h +1 -1
@@ -117,7 +117,7 @@* doc/management-notes.txt under client-pending-auth for * more details on message format */ -bool send_auth_pending_messages (struct tls_multi *tls_multi,struct tls_session *session, +bool send_auth_pending_messages (const struct tls_multi *tls_multi,struct tls_session *session,const char *extra,unsigned int timeout);void send_restart (struct context *c,const char *kill_msg);
src/openvpn/push_util.c +1 -1
@@ -222,7 +222,7 @@/* Return true if the client supports push-update */ static bool -support_push_update (struct multi_instance *mi) +support_push_update (const struct multi_instance *mi) {ASSERT (mi->context.c2.tls_multi);const unsigned int iv_proto_peer =extract_iv_proto (mi->context.c2.tls_multi->peer_info);
src/openvpn/reliable.c +3 -3
@@ -92,7 +92,7 @@/* check if a particular packet_id is present in ack */ static inline bool -reliable_ack_packet_id_present (struct reliable_ack *ack,packet_id_type pid) +reliable_ack_packet_id_present (const struct reliable_ack *ack,packet_id_type pid) {for (int i =0 ; i < ack->len; ++i) {
@@ -733,7 +733,7 @@*/ void -reliable_mark_active_incoming (struct reliable *rel,struct buffer *buf,packet_id_type pid, +reliable_mark_active_incoming (struct reliable *rel,const struct buffer *buf,packet_id_type pid,int opcode) {for (int i =0 ; i < rel->size; ++i)
@@ -793,7 +793,7 @@/* delete a buffer previously activated by reliable_mark_active() */ void -reliable_mark_deleted (struct reliable *rel,struct buffer *buf) +reliable_mark_deleted (struct reliable *rel,const struct buffer *buf) {for (int i =0 ; i < rel->size; ++i) {
src/openvpn/reliable.h +4 -4
@@ -173,7 +173,7 @@* @li False, if there are packet IDs to be acknowledged. */ static inline bool -reliable_ack_empty (struct reliable_ack *ack) +reliable_ack_empty (const struct reliable_ack *ack) {return !ack->len; }
@@ -186,7 +186,7 @@* @returns the number of outstanding acks */ static inline int -reliable_ack_outstanding (struct reliable_ack *ack) +reliable_ack_outstanding (const struct reliable_ack *ack) {return ack->len; }
@@ -336,7 +336,7 @@* @param pid The packet's packet ID. * @param opcode The packet's opcode. */ -void reliable_mark_active_incoming (struct reliable *rel,struct buffer *buf,packet_id_type pid, +void reliable_mark_active_incoming (struct reliable *rel,const struct buffer *buf,packet_id_type pid,int opcode);/**
@@ -389,7 +389,7 @@* @param rel The reliable structure associated with the given buffer. * @param buf The buffer of the reliable entry which is to be removed. */ -void reliable_mark_deleted (struct reliable *rel,struct buffer *buf); +void reliable_mark_deleted (struct reliable *rel,const struct buffer *buf);/** @} name Functions for extracting incoming packets */
src/openvpn/route.c +7 -5
@@ -898,8 +898,9 @@ }static bool -add_bypass_routes (struct route_bypass *rb,in_addr_t gateway,const struct tuntap *tt, -unsigned int flags,const struct route_gateway_info *rgi, +add_bypass_routes (const struct route_bypass *rb,in_addr_t gateway, +const struct tuntap *tt,unsigned int flags, +const struct route_gateway_info *rgi,const struct env_set *es,openvpn_net_ctx_t *ctx) {int ret = true;
@@ -916,8 +917,9 @@ }static void -del_bypass_routes (struct route_bypass *rb,in_addr_t gateway,const struct tuntap *tt, -unsigned int flags,const struct route_gateway_info *rgi, +del_bypass_routes (const struct route_bypass *rb,in_addr_t gateway, +const struct tuntap *tt,unsigned int flags, +const struct route_gateway_info *rgi,const struct env_set *es,openvpn_net_ctx_t *ctx) {int i;
@@ -3942,7 +3944,7 @@#else /* if defined(_WIN32) */ static void -get_bypass_addresses (struct route_bypass *rb,const unsigned int flags)/* PLATFORM-SPECIFIC */ +get_bypass_addresses (struct route_bypass *rb,const unsigned int flags) { }
src/openvpn/schedule.c +1 -1
@@ -501,7 +501,7 @@ }int -schedule_debug (struct schedule *s,int *count,struct timeval *least) +schedule_debug (const struct schedule *s,int *count,struct timeval *least) {struct timeval min;struct timeval max;
src/openvpn/socket.c +13 -13
@@ -647,7 +647,7 @@ }static void -bind_local (struct link_socket *sock,const sa_family_t ai_family) +bind_local (const struct link_socket *sock,const sa_family_t ai_family) {/* bind to local address/port */ if (sock->bind_local)
@@ -914,8 +914,8 @@ }void -socket_bind (socket_descriptor_t sd,struct addrinfo *local,int ai_family,const char *prefix, -bool ipv6only) +socket_bind (socket_descriptor_t sd,const struct addrinfo *local,int ai_family, +const char *prefix,bool ipv6only) {struct gc_arena gc =gc_new ();
@@ -1123,8 +1123,8 @@* such as TCP. */ -static void stream_buf_init (struct stream_buf *sb,struct buffer *buf,const unsigned int sockflags, -const int proto); +static void stream_buf_init (struct stream_buf *sb,const struct buffer *buf, +const unsigned int sockflags,const int proto);static void stream_buf_close (struct stream_buf *sb);
@@ -1481,7 +1481,7 @@ }static void -phase2_set_socket_flags (struct link_socket *sock) +phase2_set_socket_flags (const struct link_socket *sock) {/* set misc socket parameters */ socket_set_flags (sock->sd, sock->sockflags);
@@ -2073,7 +2073,7 @@ }static void -stream_buf_init (struct stream_buf *sb,struct buffer *buf,const unsigned int sockflags, +stream_buf_init (struct stream_buf *sb,const struct buffer *buf,const unsigned int sockflags,const int proto) { sb->buf_init = *buf;
@@ -2337,7 +2337,7 @@#endif static socklen_t -link_socket_read_udp_posix_recvmsg (struct link_socket *sock,struct buffer *buf, +link_socket_read_udp_posix_recvmsg (const struct link_socket *sock,struct buffer *buf,struct link_socket_actual *from) {struct iovec iov;
@@ -2405,7 +2405,7 @@#endif /* if ENABLE_IP_PKTINFO */ int -link_socket_read_udp_posix (struct link_socket *sock,struct buffer *buf, +link_socket_read_udp_posix (const struct link_socket *sock,struct buffer *buf,struct link_socket_actual *from) {socklen_t fromlen =sizeof (from->dest.addr);
@@ -2462,7 +2462,7 @@#if ENABLE_IP_PKTINFO ssize_t -link_socket_write_udp_posix_sendmsg (struct link_socket *sock,struct buffer *buf, +link_socket_write_udp_posix_sendmsg (const struct link_socket *sock,const struct buffer *buf,struct link_socket_actual *to) {struct iovec iov;
@@ -2656,7 +2656,7 @@ }int -socket_send_queue (struct link_socket *sock,struct buffer *buf,const struct link_socket_actual *to) +socket_send_queue (struct link_socket *sock,const struct buffer *buf,const struct link_socket_actual *to) {if (sock->writes.iostate ==IOSTATE_INITIAL ) {
@@ -2756,8 +2756,8 @@return sock->writes.iostate; } -void -read_sockaddr_from_overlapped (struct overlapped_io *io,struct sockaddr *dst,int overlapped_ret) +static void +read_sockaddr_from_overlapped (const struct overlapped_io *io,struct sockaddr *dst,int overlapped_ret) {if (overlapped_ret >=0 && io->addr_defined) {
src/openvpn/socket.h +11 -9
@@ -267,7 +267,7 @@int socket_recv_queue (struct link_socket *sock,int maxsize); -int socket_send_queue (struct link_socket *sock,struct buffer *buf, +int socket_send_queue (struct link_socket *sock,const struct buffer *buf,const struct link_socket_actual *to); typedef struct
@@ -347,8 +347,8 @@struct link_socket *link_socket_new (void ); -void socket_bind (socket_descriptor_t sd,struct addrinfo *local,int af_family,const char *prefix, -bool ipv6only); +void socket_bind (socket_descriptor_t sd,const struct addrinfo *local,int af_family, +const char *prefix,bool ipv6only);int openvpn_connect (socket_descriptor_t sd,const struct sockaddr *remote,int connect_timeout,volatile int *signal_received);
@@ -484,7 +484,7 @@ }static inline bool -link_socket_verify_incoming_addr (struct buffer *buf,const struct link_socket_info *info, +link_socket_verify_incoming_addr (const struct buffer *buf,const struct link_socket_info *info,const struct link_socket_actual *from_addr) {if (buf->len >0 )
@@ -608,7 +608,7 @@#else /* ifdef _WIN32 */ -int link_socket_read_udp_posix (struct link_socket *sock,struct buffer *buf, +int link_socket_read_udp_posix (const struct link_socket *sock,struct buffer *buf,struct link_socket_actual *from);#endif /* ifdef _WIN32 */
@@ -694,12 +694,12 @@#else /* ifdef _WIN32 */ -ssize_t link_socket_write_udp_posix_sendmsg (struct link_socket *sock,struct buffer *buf, +ssize_t link_socket_write_udp_posix_sendmsg (const struct link_socket *sock,const struct buffer *buf,struct link_socket_actual *to);static inline ssize_t -link_socket_write_udp_posix (struct link_socket *sock,struct buffer *buf, +link_socket_write_udp_posix (const struct link_socket *sock,const struct buffer *buf,struct link_socket_actual *to) {#if ENABLE_IP_PKTINFO
@@ -715,7 +715,7 @@ }static inline ssize_t -link_socket_write_tcp_posix (struct link_socket *sock,struct buffer *buf) +link_socket_write_tcp_posix (const struct link_socket *sock,const struct buffer *buf) {return send (sock->sd,BPTR (buf),BLENZ (buf),MSG_NOSIGNAL ); }
@@ -773,7 +773,7 @@* from tunnel packet. */ static inline void -link_socket_set_tos (struct link_socket *sock) +link_socket_set_tos (const struct link_socket *sock) {if (sock && sock->ptos_defined) {
@@ -819,6 +819,8 @@ } } +/* cppcheck-suppress constParameterPointer +* sock is modified on Windows via &sock->listen_handle */ static inline void socket_reset_listen_persistent (struct link_socket *sock) {
src/openvpn/socket_util.h +1 -1
@@ -439,7 +439,7 @@static inline bool -addrlist_match_proto (const struct openvpn_sockaddr *a1,struct addrinfo *addr_list,const int proto) +addrlist_match_proto (const struct openvpn_sockaddr *a1,const struct addrinfo *addr_list,const int proto) {return link_socket_proto_connection_oriented (proto) ?addrlist_match (a1, addr_list) :addrlist_port_match (a1, addr_list);
src/openvpn/socks.c +10 -10
@@ -82,7 +82,7 @@static bool socks_proxy_recv_char (uint8_t *c,const char *name,socket_descriptor_t sd, -struct event_timeout *server_poll_timeout, +const struct event_timeout *server_poll_timeout,volatile int *signal_received) {fd_set reads;
@@ -97,8 +97,8 @@ }static bool -socks_username_password_auth (struct socks_proxy_info *p,socket_descriptor_t sd, -struct event_timeout *server_poll_timeout, +socks_username_password_auth (const struct socks_proxy_info *p,socket_descriptor_t sd, +const struct event_timeout *server_poll_timeout,volatile int *signal_received) {char to_send[516 ];
@@ -156,8 +156,8 @@ }static bool -socks_handshake (struct socks_proxy_info *p,socket_descriptor_t sd, -struct event_timeout *server_poll_timeout,volatile int *signal_received) +socks_handshake (const struct socks_proxy_info *p,socket_descriptor_t sd, +const struct event_timeout *server_poll_timeout,volatile int *signal_received) {uint8_t buf[2 ];int len =0 ;
@@ -231,7 +231,7 @@static bool recv_socks_reply (socket_descriptor_t sd,struct openvpn_sockaddr *addr, -struct event_timeout *server_poll_timeout,volatile int *signal_received) +const struct event_timeout *server_poll_timeout,volatile int *signal_received) {uint8_t atyp =0 ;int alen =0 ;
@@ -334,11 +334,11 @@ }void -establish_socks_proxy_passthru (struct socks_proxy_info *p, +establish_socks_proxy_passthru (const struct socks_proxy_info *p,socket_descriptor_t sd,/* already open to proxy */ const char *host,/* openvpn server remote */ const char *servname,/* openvpn server port */ -struct event_timeout *server_poll_timeout, +const struct event_timeout *server_poll_timeout,struct signal_info *sig_info) {char buf[270 ];
@@ -392,10 +392,10 @@ }void -establish_socks_proxy_udpassoc (struct socks_proxy_info *p, +establish_socks_proxy_udpassoc (const struct socks_proxy_info *p,socket_descriptor_t ctrl_sd,/* already open to proxy */ struct openvpn_sockaddr *relay_addr, -struct event_timeout *server_poll_timeout, +const struct event_timeout *server_poll_timeout,struct signal_info *sig_info) {if (!socks_handshake (p, ctrl_sd, server_poll_timeout, &sig_info->signal_received))
src/openvpn/socks.h +4 -4
@@ -47,17 +47,17 @@void socks_proxy_close (struct socks_proxy_info *sp); -void establish_socks_proxy_passthru (struct socks_proxy_info *p, +void establish_socks_proxy_passthru (const struct socks_proxy_info *p,socket_descriptor_t sd,/* already open to proxy */ const char *host,/* openvpn server remote */ const char *servname,/* openvpn server port */ -struct event_timeout *server_poll_timeout, +const struct event_timeout *server_poll_timeout,struct signal_info *sig_info); -void establish_socks_proxy_udpassoc (struct socks_proxy_info *p, +void establish_socks_proxy_udpassoc (const struct socks_proxy_info *p,socket_descriptor_t ctrl_sd,/* already open to proxy */ struct openvpn_sockaddr *relay_addr, -struct event_timeout *server_poll_timeout, +const struct event_timeout *server_poll_timeout,struct signal_info *sig_info);void socks_process_incoming_udp (struct buffer *buf,struct link_socket_actual *from);
src/openvpn/ssl.c +12 -11
@@ -1159,7 +1159,7 @@ }struct tls_multi * -tls_multi_init (struct tls_options *tls_options) +tls_multi_init (const struct tls_options *tls_options) {struct tls_multi *ret;
@@ -1188,7 +1188,7 @@*/ struct tls_auth_standalone * -tls_auth_standalone_init (struct tls_options *tls_options,struct gc_arena *gc) +tls_auth_standalone_init (const struct tls_options *tls_options,struct gc_arena *gc) {struct tls_auth_standalone *tas;
@@ -1336,7 +1336,7 @@static void init_epoch_keys (struct key_state *ks,struct tls_multi *multi,const struct key_type *key_type, -bool server,struct key2 *key2) +bool server,const struct key2 *key2) {/* For now we hardcode this to be 16 for the software based data channel * DCO based implementations/HW implementation might adjust this number
@@ -1375,7 +1375,7 @@static void init_key_contexts (struct key_state *ks,struct tls_multi *multi,const struct key_type *key_type, -bool server,struct key2 *key2,bool dco_enabled) +bool server,const struct key2 *key2,bool dco_enabled) {struct key_ctx_bi *key = &ks->crypto_options.key_ctx_bi;
@@ -1573,8 +1573,9 @@bool tls_session_update_crypto_params_do_work (struct tls_multi *multi,struct tls_session *session, -struct options *options,struct frame *frame, -struct frame *frame_fragment,struct link_socket_info *lsi, +const struct options *options,struct frame *frame, +struct frame *frame_fragment, +const struct link_socket_info *lsi,dco_context_t *dco) {if (session->key[KS_PRIMARY ].crypto_options.key_ctx_bi.initialized)
@@ -1643,7 +1644,7 @@bool tls_session_update_crypto_params (struct tls_multi *multi,struct tls_session *session,struct options *options,struct frame *frame, -struct frame *frame_fragment,struct link_socket_info *lsi, +struct frame *frame_fragment,const struct link_socket_info *lsi,dco_context_t *dco) {if (!check_session_cipher (session, options))
@@ -2495,8 +2496,8 @@ }bool -session_skip_to_pre_start (struct tls_session *session,struct tls_pre_decrypt_state *state, -struct link_socket_actual *from) +session_skip_to_pre_start (struct tls_session *session,const struct tls_pre_decrypt_state *state, +const struct link_socket_actual *from) {struct key_state *ks = &session->key[KS_PRIMARY ]; ks->session_id_remote = state->peer_session_id;
@@ -4011,7 +4012,7 @@ }void -tls_post_encrypt (struct tls_multi *multi,struct buffer *buf) +tls_post_encrypt (struct tls_multi *multi,const struct buffer *buf) {struct key_state *ks = multi->save_ks; multi->save_ks =NULL ;
@@ -4142,7 +4143,7 @@* into a garbage collectable string which is returned. */ const char * -protocol_dump (struct buffer *buffer,unsigned int flags,struct gc_arena *gc) +protocol_dump (const struct buffer *buffer,unsigned int flags,struct gc_arena *gc) {struct buffer out =alloc_buf_gc (256 , gc);struct buffer buf = *buffer;
src/openvpn/ssl.h +8 -7
@@ -166,7 +166,7 @@* * @return A newly allocated and initialized \c tls_multi structure. */ -struct tls_multi *tls_multi_init (struct tls_options *tls_options); +struct tls_multi *tls_multi_init (const struct tls_options *tls_options);/** * Finalize initialization of a \c tls_multi structure.
@@ -187,7 +187,7 @@/* * Initialize a standalone tls-auth verification object. */ -struct tls_auth_standalone *tls_auth_standalone_init (struct tls_options *tls_options, +struct tls_auth_standalone *tls_auth_standalone_init (const struct tls_options *tls_options,struct gc_arena *gc);/**
@@ -371,7 +371,7 @@* @param multi - The TLS state for this packet's destination VPN tunnel. * @param buf - The buffer containing the outgoing packet. */ -void tls_post_encrypt (struct tls_multi *multi,struct buffer *buf); +void tls_post_encrypt (struct tls_multi *multi,const struct buffer *buf);/** @} name Functions for managing security parameter state for data channel packets */
@@ -461,7 +461,8 @@*/ bool tls_session_update_crypto_params (struct tls_multi *multi,struct tls_session *session,struct options *options,struct frame *frame, -struct frame *frame_fragment,struct link_socket_info *lsi, +struct frame *frame_fragment, +const struct link_socket_info *lsi,dco_context_t *dco);/*
@@ -525,7 +526,7 @@#define PD_VERBOSE (1 << 10)#define PD_TLS_CRYPT (1 << 11) -const char *protocol_dump (struct buffer *buffer,unsigned int flags,struct gc_arena *gc); +const char *protocol_dump (const struct buffer *buffer,unsigned int flags,struct gc_arena *gc);/* * debugging code
@@ -573,7 +574,7 @@/* Special method to skip the three way handshake RESET stages. This is * used by the HMAC code when seeing a packet that matches the previous * HMAC based stateless server state */ -bool session_skip_to_pre_start (struct tls_session *session,struct tls_pre_decrypt_state *state, -struct link_socket_actual *from); +bool session_skip_to_pre_start (struct tls_session *session,const struct tls_pre_decrypt_state *state, +const struct link_socket_actual *from);#endif /* ifndef OPENVPN_SSL_H */
src/openvpn/ssl_backend.h +2 -2
@@ -144,7 +144,7 @@* * @return true if the context is initialised, false if not. */ -bool tls_ctx_initialised (struct tls_root_ctx *ctx); +bool tls_ctx_initialised (const struct tls_root_ctx *ctx);/** * Set any library specific options.
@@ -177,7 +177,7 @@* @param ciphers String containing : delimited cipher names, or NULL to use * sane defaults. */ -void tls_ctx_restrict_ciphers_tls13 (struct tls_root_ctx *ctx,const char *ciphers); +void tls_ctx_restrict_ciphers_tls13 (const struct tls_root_ctx *ctx,const char *ciphers);/** * Set the TLS certificate profile. The profile defines which crypto
src/openvpn/ssl_mbedtls.c +2 -2
@@ -161,7 +161,7 @@ }bool -tls_ctx_initialised (struct tls_root_ctx *ctx) +tls_ctx_initialised (const struct tls_root_ctx *ctx) {/* either this should be NULL or should be non-null and then have a * valid TLS ctx inside as well */
@@ -284,7 +284,7 @@ }void -tls_ctx_restrict_ciphers_tls13 (struct tls_root_ctx *ctx,const char *ciphers) +tls_ctx_restrict_ciphers_tls13 (const struct tls_root_ctx *ctx,const char *ciphers) {if (ciphers ==NULL ) {
src/openvpn/ssl_openssl.c +5 -5
@@ -147,7 +147,7 @@ }bool -tls_ctx_initialised (struct tls_root_ctx *ctx) +tls_ctx_initialised (const struct tls_root_ctx *ctx) {/* either this should be NULL or should be non-null and then have a * valid TLS ctx inside as well */
@@ -509,7 +509,7 @@#endif void -tls_ctx_restrict_ciphers_tls13 (struct tls_root_ctx *ctx,const char *ciphers) +tls_ctx_restrict_ciphers_tls13 (const struct tls_root_ctx *ctx,const char *ciphers) {if (ciphers ==NULL ) {
@@ -1165,7 +1165,7 @@ }static void -tls_ctx_load_cert_uri (struct tls_root_ctx *tls_ctx,const char *uri) +tls_ctx_load_cert_uri (const struct tls_root_ctx *tls_ctx,const char *uri) {#if defined(HAVE_OPENSSL_STORE_API )X509 *x =NULL ;
@@ -2078,7 +2078,7 @@ }static void -bio_debug_data (const char *mode,BIO *bio,const uint8_t *buf,int len,const char *desc) +bio_debug_data (const char *mode,const BIO *bio,const uint8_t *buf,int len,const char *desc) {struct gc_arena gc =gc_new ();if (len >0 )
@@ -2092,7 +2092,7 @@ }static void -bio_debug_oc (const char *mode,BIO *bio) +bio_debug_oc (const char *mode,const BIO *bio) {open_biofp (); fprintf(biofp, "BIO %s time=%" PRIi64 " bio=" ptr_format "\n", mode, (int64_t)time(NULL),
src/openvpn/ssl_pkt.c +5 -5
@@ -57,7 +57,7 @@* @return if the swap was successful (buf was large enough) */ static bool -swap_hmac (struct buffer *buf,const struct crypto_options *co,bool incoming) +swap_hmac (const struct buffer *buf,const struct crypto_options *co,bool incoming) {ASSERT (co);
@@ -117,7 +117,7 @@*/ static void tls_wrap_control (struct tls_wrap_ctx *ctx,uint8_t header,struct buffer *buf, -struct session_id *session_id) +const struct session_id *session_id) {if (ctx->mode ==TLS_WRAP_AUTH || ctx->mode ==TLS_WRAP_NONE ) {
@@ -403,9 +403,9 @@struct buffer -tls_reset_standalone (struct tls_wrap_ctx *ctx,struct tls_auth_standalone *tas, -struct session_id *own_sid,struct session_id *remote_sid,uint8_t header, -bool request_resend_wkc) +tls_reset_standalone (struct tls_wrap_ctx *ctx,const struct tls_auth_standalone *tas, +const struct session_id *own_sid,const struct session_id *remote_sid, +uint8_t header,bool request_resend_wkc) {/* Copy buffer here to point at the same data but allow tls_wrap_control * to potentially change buf to point to another buffer without
src/openvpn/ssl_pkt.h +3 -2
@@ -220,8 +220,9 @@* from the tls pre decrypt state. * */ -struct buffer tls_reset_standalone (struct tls_wrap_ctx *ctx,struct tls_auth_standalone *tas, -struct session_id *own_sid,struct session_id *remote_sid, +struct buffer tls_reset_standalone (struct tls_wrap_ctx *ctx,const struct tls_auth_standalone *tas, +const struct session_id *own_sid, +const struct session_id *remote_sid,uint8_t header,bool request_resend_wkc);
src/openvpn/ssl_verify.c +4 -4
@@ -1137,7 +1137,7 @@* cache. */ static bool -tls_authentication_status_use_cache (struct tls_multi *multi) +tls_authentication_status_use_cache (const struct tls_multi *multi) {unsigned int idx =min_uint (multi->tas_cache_num_updates,SIZE (cache_intervals) -1 );time_t latency = cache_intervals[idx];
@@ -1281,7 +1281,7 @@* Check if the script/plugin left a message in the auth failed message * file and relay it to the user */ static void -check_for_client_reason (struct tls_multi *multi,struct auth_deferred_status *status) +check_for_client_reason (struct tls_multi *multi,const struct auth_deferred_status *status) {struct gc_arena gc =gc_new ();const char *msg =key_state_check_auth_failed_message_file (status, &gc);
@@ -1550,7 +1550,7 @@#endif /* ifdef ENABLE_MANAGEMENT */ static bool -set_verify_user_pass_env (struct user_pass *up,struct tls_multi *multi,struct tls_session *session) +set_verify_user_pass_env (const struct user_pass *up,struct tls_multi *multi,struct tls_session *session) {/* Is username defined? */ if ((session->opt->ssl_flags &SSLF_AUTH_USER_PASS_OPTIONAL ) ||strlen (up->username))
@@ -1578,7 +1578,7 @@ }bool -ssl_verify_username_length (struct tls_session *session,const char *username) +ssl_verify_username_length (const struct tls_session *session,const char *username) {if ((session->opt->ssl_flags &SSLF_USERNAME_AS_COMMON_NAME ) &&strlen (username) >TLS_USERNAME_LEN )
src/openvpn/ssl_verify.h +2 -2
@@ -202,7 +202,7 @@* @return true if name is under limit or username-as-common-name * is not active */ -bool ssl_verify_username_length (struct tls_session *session,const char *username); +bool ssl_verify_username_length (const struct tls_session *session,const char *username);/** * Runs the --client-crresponse script if one is defined.
@@ -275,7 +275,7 @@void auth_set_client_reason (struct tls_multi *multi,const char *client_reason);static inline const char * -tls_client_reason (struct tls_multi *multi) +tls_client_reason (const struct tls_multi *multi) {return multi->client_reason; }
src/openvpn/status.c +1 -1
@@ -135,7 +135,7 @@ }void -status_reset (struct status_output *so) +status_reset (const struct status_output *so) {if (so && so->fd >=0 ) {
src/openvpn/status.h +1 -1
@@ -69,7 +69,7 @@bool status_trigger (struct status_output *so); -void status_reset (struct status_output *so); +void status_reset (const struct status_output *so);void status_flush (struct status_output *so);
src/openvpn/tun.c +18 -18
@@ -835,7 +835,7 @@const char *ifconfig_ipv6_local_parm,/* --ifconfig parm 1 IPv6 */ int ifconfig_ipv6_netbits_parm, const char *ifconfig_ipv6_remote_parm, /* --ifconfig parm 2 IPv6 */ - struct addrinfo *local_public, struct addrinfo *remote_public, const bool strict_warn, + const struct addrinfo *local_public, const struct addrinfo *remote_public, const bool strict_warn, struct env_set *es, openvpn_net_ctx_t *ctx, struct tuntap *tt) { if (!tt)
@@ -978,7 +978,7 @@* -> helper function to simplify code below */ static void -add_route_connected_v6_net (struct tuntap *tt,const struct env_set *es) +add_route_connected_v6_net (const struct tuntap *tt,const struct env_set *es) {struct route_ipv6 r6;
@@ -1020,7 +1020,7 @@*/ in_addr_t -create_arbitrary_remote (struct tuntap *tt) +create_arbitrary_remote (const struct tuntap *tt) {in_addr_t remote;
@@ -1592,7 +1592,7 @@ }static void -undo_ifconfig_ipv4 (struct tuntap *tt,openvpn_net_ctx_t *ctx) +undo_ifconfig_ipv4 (const struct tuntap *tt,openvpn_net_ctx_t *ctx) {#if defined(TARGET_LINUX )int netbits =netmask_to_netbits2 (tt->remote_netmask);
@@ -1627,7 +1627,7 @@ }static void -undo_ifconfig_ipv6 (struct tuntap *tt,openvpn_net_ctx_t *ctx) +undo_ifconfig_ipv6 (const struct tuntap *tt,openvpn_net_ctx_t *ctx) {#if defined(TARGET_LINUX )if (net_addr_v6_del (ctx, tt->actual_name, &tt->local_ipv6, tt->netbits_ipv6) <0 )
@@ -1652,7 +1652,7 @@ }void -undo_ifconfig (struct tuntap *tt,openvpn_net_ctx_t *ctx) +undo_ifconfig (const struct tuntap *tt,openvpn_net_ctx_t *ctx) {if (tt->backend_driver !=DRIVER_NULL && tt->backend_driver !=DRIVER_AFUNIX ) {
@@ -1808,7 +1808,7 @@#if defined(TARGET_LINUX ) || defined(TARGET_FREEBSD )static bool -tun_dco_enabled (struct tuntap *tt) +tun_dco_enabled (const struct tuntap *tt) {return tt->backend_driver ==DRIVER_DCO ; }
@@ -2055,13 +2055,13 @@ }ssize_t -write_tun (struct tuntap *tt,uint8_t *buf,int len) +write_tun (const struct tuntap *tt,const uint8_t *buf,int len) {return write (tt->fd, buf, len); }ssize_t -read_tun (struct tuntap *tt,uint8_t *buf,int len) +read_tun (const struct tuntap *tt,const uint8_t *buf,int len) {return read (tt->fd, buf, len); }
@@ -2260,13 +2260,13 @@ }ssize_t -write_tun (struct tuntap *tt,uint8_t *buf,int len) +write_tun (const struct tuntap *tt,const uint8_t *buf,int len) {return write (tt->fd, buf, len); }ssize_t -read_tun (struct tuntap *tt,uint8_t *buf,int len) +read_tun (const struct tuntap *tt,uint8_t *buf,int len) {return read (tt->fd, buf, len); }
@@ -2596,7 +2596,7 @@ }ssize_t -write_tun (struct tuntap *tt,uint8_t *buf,int len) +write_tun (const struct tuntap *tt,const uint8_t *buf,int len) {struct strbuf sbuf; sbuf.len = len;
@@ -2605,7 +2605,7 @@ }ssize_t -read_tun (struct tuntap *tt,uint8_t *buf,int len) +read_tun (const struct tuntap *tt,uint8_t *buf,int len) {struct strbuf sbuf;int f =0 ;
@@ -3320,7 +3320,7 @@ }int -tun_write_queue (struct tuntap *tt,struct buffer *buf) +tun_write_queue (struct tuntap *tt,const struct buffer *buf) {if (tt->writes.iostate ==IOSTATE_INITIAL ) {
@@ -3375,7 +3375,7 @@ }int -tun_write_win32 (struct tuntap *tt,struct buffer *buf) +tun_write_win32 (struct tuntap *tt,const struct buffer *buf) {int err =0 ;int status =0 ;
@@ -5383,7 +5383,7 @@ }void -fork_register_dns_action (struct tuntap *tt) +fork_register_dns_action (const struct tuntap *tt) {if (tt && tt->options.register_dns && tt->options.msg_channel) {
@@ -5473,7 +5473,7 @@ }static void -tuntap_get_mtu (struct tuntap *tt) +tuntap_get_mtu (const struct tuntap *tt) {ULONG mtu =0 ;DWORD len;
@@ -6048,7 +6048,7 @@ }void -tun_show_debug (struct tuntap *tt) +tun_show_debug (const struct tuntap *tt) {if (tt->backend_driver ==WINDOWS_DRIVER_TAP_WINDOWS6 ) {
src/openvpn/tun.h +16 -16
@@ -272,9 +272,9 @@void close_tun_handle (struct tuntap *tt); -ssize_t write_tun (struct tuntap *tt,uint8_t *buf,int len); +ssize_t write_tun (const struct tuntap *tt,const uint8_t *buf,int len); -ssize_t read_tun (struct tuntap *tt,uint8_t *buf,int len); +ssize_t read_tun (const struct tuntap *tt,uint8_t *buf,int len);#ifdef ENABLE_FEATURE_TUN_PERSIST void tuncfg(const char *dev, const char *dev_type, const char *dev_node, int persist_mode,
@@ -293,7 +293,7 @@const char *ifconfig_ipv6_local_parm,/* --ifconfig parm 1 / IPv6 */ int ifconfig_ipv6_netbits_parm, /* --ifconfig parm 1 / bits */ const char *ifconfig_ipv6_remote_parm, /* --ifconfig parm 2 / IPv6 */ - struct addrinfo *local_public, struct addrinfo *remote_public, + const struct addrinfo *local_public, const struct addrinfo *remote_public, const bool strict_warn, struct env_set *es, openvpn_net_ctx_t *ctx, struct tuntap *tt);
@@ -320,7 +320,7 @@* @param tt the tuntap interface context * @param ctx the networking API opaque context */ -void undo_ifconfig (struct tuntap *tt,openvpn_net_ctx_t *ctx); +void undo_ifconfig (const struct tuntap *tt,openvpn_net_ctx_t *ctx);bool is_dev_type (const char *dev,const char *dev_type,const char *match_type);
@@ -351,7 +351,7 @@#define IFCONFIG_DEFAULT IFCONFIG_AFTER_TUN_OPENstatic inline int -ifconfig_order (struct tuntap *tt) +ifconfig_order (const struct tuntap *tt) {if (tt->backend_driver ==DRIVER_AFUNIX ) {
@@ -381,7 +381,7 @@#define ROUTE_ORDER_DEFAULT ROUTE_AFTER_TUNstatic inline int -route_order (struct tuntap *tt) +route_order (const struct tuntap *tt) {if (tt->backend_driver ==DRIVER_AFUNIX ) {
@@ -454,13 +454,13 @@const char *tap_win_getinfo (const struct tuntap *tt,struct gc_arena *gc); -void tun_show_debug (struct tuntap *tt); +void tun_show_debug (const struct tuntap *tt);bool dhcp_release_by_adapter_index (const DWORD adapter_index);bool dhcp_renew_by_adapter_index (const DWORD adapter_index); -void fork_register_dns_action (struct tuntap *tt); +void fork_register_dns_action (const struct tuntap *tt);void ipconfig_register_dns (const struct env_set *es);
@@ -470,7 +470,7 @@int tun_read_queue (struct tuntap *tt,int maxsize); -int tun_write_queue (struct tuntap *tt,struct buffer *buf); +int tun_write_queue (struct tuntap *tt,const struct buffer *buf);static inline bool tuntap_stop (int status)
@@ -499,7 +499,7 @@return false; } -int tun_write_win32 (struct tuntap *tt,struct buffer *buf); +int tun_write_win32 (struct tuntap *tt,const struct buffer *buf);static inline bool is_ip_packet_valid (const struct buffer *buf)
@@ -529,13 +529,13 @@ }static inline bool -tuntap_is_dco_win (struct tuntap *tt) +tuntap_is_dco_win (const struct tuntap *tt) {return tt && tt->backend_driver ==DRIVER_DCO ; }static inline bool -tuntap_is_dco_win_timeout (struct tuntap *tt,int status) +tuntap_is_dco_win_timeout (const struct tuntap *tt,int status) {return tuntap_is_dco_win (tt) && (status <0 ) && (openvpn_errno () ==ERROR_NETNAME_DELETED ); }
@@ -555,25 +555,25 @@ }static inline void -tun_standby_init (struct tuntap *tt) +tun_standby_init (const struct tuntap *tt) { }static inline bool -tun_standby (struct tuntap *tt) +tun_standby (const struct tuntap *tt) {return true; }static inline bool -tuntap_is_dco_win (struct tuntap *tt) +tuntap_is_dco_win (const struct tuntap *tt) {return false; }static inline bool -tuntap_is_dco_win_timeout (struct tuntap *tt,int status) +tuntap_is_dco_win_timeout (const struct tuntap *tt,int status) {return false; }
src/openvpn/tun_afunix.c +2 -2
@@ -48,7 +48,7 @@static void -tun_afunix_exec_child (const char *dev_node,struct tuntap *tt,struct env_set *env) +tun_afunix_exec_child (const char *dev_node,struct tuntap *tt,const struct env_set *env) {const char *msgprefix ="ERROR: failure executing process for tun:" ;struct argv argv =argv_new ();
@@ -73,7 +73,7 @@ }void -open_tun_afunix (struct options *o,int mtu,struct tuntap *tt,struct env_set *orig_env) +open_tun_afunix (const struct options *o,int mtu,struct tuntap *tt,const struct env_set *orig_env) {struct gc_arena gc =gc_new ();
src/openvpn/tun_afunix.h +1 -1
@@ -31,7 +31,7 @@* the user provided taking care of implementing the actual tun * device. */ -void open_tun_afunix (struct options *o,int mtu,struct tuntap *tt,struct env_set *env); +void open_tun_afunix (const struct options *o,int mtu,struct tuntap *tt,const struct env_set *env);/**
src/openvpn/vlan.c +1 -1
@@ -288,7 +288,7 @@ }void -vlan_process_outgoing_tun (struct multi_context *m,struct multi_instance *mi) +vlan_process_outgoing_tun (const struct multi_context *m,struct multi_instance *mi) {if (!m->top.options.vlan_tagging) {
src/openvpn/vlan.h +1 -1
@@ -35,6 +35,6 @@bool vlan_is_tagged (const struct buffer *buf); -void vlan_process_outgoing_tun (struct multi_context *m,struct multi_instance *mi); +void vlan_process_outgoing_tun (const struct multi_context *m,struct multi_instance *mi);#endif /* VLAN_H */
src/openvpn/win32.h +1 -1
@@ -226,7 +226,7 @@void overlapped_io_close (struct overlapped_io *o);static inline bool -overlapped_io_active (struct overlapped_io *o) +overlapped_io_active (const struct overlapped_io *o) {return o->iostate ==IOSTATE_QUEUED || o->iostate ==IOSTATE_IMMEDIATE_RETURN ; }
src/openvpnmsica/openvpnmsica.c +1 -1
@@ -77,7 +77,7 @@* @return ERROR_SUCCESS on success; An error code otherwise */ static UINT -setup_sequence(_In_ MSIHANDLE hInstall, _In_z_ LPCWSTR szProperty, _In_ struct msica_arg_seq *seq) +setup_sequence(_In_ MSIHANDLE hInstall, _In_z_ LPCWSTR szProperty, _In_ const struct msica_arg_seq *seq) {UINT uiResult;LPWSTR szSequence =msica_arg_seq_join (seq);
src/openvpnserv/interactive.c +2 -2
@@ -521,7 +521,7 @@static SOCKADDR_INET -sockaddr_inet (short family,inet_address_t *addr) +sockaddr_inet (short family,const inet_address_t *addr) {SOCKADDR_INET sa_inet;ZeroMemory (&sa_inet,sizeof (sa_inet));
@@ -3733,7 +3733,7 @@static DWORD UpdateWaitHandles (LPHANDLE *handles_ptr,LPDWORD count,HANDLE io_event,HANDLE exit_event, -list_item_t *threads) +const list_item_t *threads) {static DWORD size =10 ;static LPHANDLE handles =NULL ;
tests/unit_tests/openvpn/mock_management.c +1 -1
@@ -36,7 +36,7 @@struct management *management;/* GLOBAL */ void -management_auth_failure (struct management *man,const char *type,const char *reason) +management_auth_failure (const struct management *man,const char *type,const char *reason) {ASSERT (false); }
tests/unit_tests/openvpn/test_misc.c +1 -1
@@ -146,7 +146,7 @@ }static struct hash_element * -hash_lookup_by_value (struct hash *hash,void *value) +hash_lookup_by_value (struct hash *hash,const void *value) {struct hash_iterator hi;struct hash_element *he;
tests/unit_tests/openvpn/test_user_pass.c +1 -1
@@ -59,7 +59,7 @@return mock (); }void -management_auth_failure (struct management *man,const char *type,const char *reason) +management_auth_failure (const struct management *man,const char *type,const char *reason) {assert_true (0 ); }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1663?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I56248cf6d199c2da770774b8fd1e5daf2b116f58
Gerrit-Change-Number: 1663
Gerrit-PatchSet: 4
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>